纯css设置各行变色

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

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

posted @ 2019-08-18 09:10  养一只Tom猫  阅读(529)  评论(0编辑  收藏  举报