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.
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; }
2. table.init() method:
layui.table.init('tableId', { elem: '#table', cols: [[]], style: 'background-color: #f2f2f2;' });
3. tr. css({ 'background-color': '#f2f2f2' }) method:
layui.table.on('row', function(obj) { obj.tr.css({ 'background-color': '#f2f2f2' }); });
In the above method, "#f2f2f2" can be replaced with the background color value you want.
Detailed description:
tr td
) Set the background color to uniformly set the background color of the entire table.style
option.row
event 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!