How to set the background color of layui table

下次还敢
Release: 2024-04-28 22:03:14
Original
542 people have browsed it

Layui table background color can be set through the following methods: 1. CSS style sheet; 2. table.init() method; 3. tr.css() method. In the above method, "#f2f2f2" can be replaced for your desired background color value.

How to set the background color of layui table

layui table background color setting

layui The background color of the table can be set by the following method:

1. CSS style sheet:

.layui-table tr td { background-color: #f2f2f2; }
Copy after login

2. table.init() method:

layui.table.init('tableId', { elem: '#table', cols: [[]], style: 'background-color: #f2f2f2;' });
Copy after login

3. tr. css({ 'background-color': '#f2f2f2' }) method:

layui.table.on('row', function(obj) { obj.tr.css({ 'background-color': '#f2f2f2' }); });
Copy after login

In the above method, "#f2f2f2" can be replaced with the background color value you want.

Detailed description:

  • CSS style sheet:Passed as the cell of the table (tr td) Set the background color to uniformly set the background color of the entire table.
  • table.init() method:When initializing the table, you can set the background color of the table through thestyleoption.
  • tr.css() method:In therowevent of the table, you can dynamically set a row through thetr.css()method or background color for multiple lines.

The above is the detailed content of How to set the background color of layui table. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!