让table实现条纹行,使用CSS3 :nth-of-type() 选择器

说明参见连接:http://www.w3school.com.cn/cssref/selector_nth-of-type.asp

代码:

table>tbody>tr:nth-of-type(even ) {
    background-color: #f9f9f9;
}

表示table的偶数行(even表示偶数,odd表示奇数)的背景颜色是#f9f9f9;而奇数行的背景色不变


原文出处:/show_1C7FjItzcZ4.html