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

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

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");


你可能感兴趣的:(表格的隔行变色,实现方法)