表格的隔行变色,实现方法

来源:互联网 发布:python数据分析 mobi 编辑:程序博客网 时间:2024/04/30 10:44

表格中的隔行变色,很常见

1.css3实现:pc端现在支持的不多

table li:nth-of-type(odd){background:#FAFAFA;}/*奇数行*/ table li:nth-of-type(even){background:#FAFAFA;}/*偶数行*/ 


2.jquery 实现 :兼容大部分的浏览器

$("tr:odd").css("background-color","#FAFAFA");$("tr:even").css("background-color","#FAFAFA");


0 0
原创粉丝点击