纯css设置各行变色

/*从第二行(偶数行)开始变色*/
table tr:th-child(2n){
background-color:red;
}

/*从第一行(奇数行)开始变色*/
table tr:nth-child(2n-1){
background-color:red;
}

原文地址:https://www.cnblogs.com/yanghaoyu0624/p/11371426.html