奇偶数行背景色不同:
/*设置表格奇偶数行背景色不同*/
.table-responsive table tbody tr:nth-child(even){
background: rgba(250,250,255,1)
}
.table-responsive table tbody tr:nth-child(odd){
background:rgba(255,255,255,1);
}
奇偶数列背景色不同:
/*设置表格奇偶数列背景色不同*/
.table-responsive table tbody th:nth-child(even){
background: rgba(250,250,255,1)
}
.table-responsive table tbody th:nth-child(odd){
background:rgba(255,255,255,1);
}

本文介绍了一种使用CSS选择器 nth-child 来为表格的奇数和偶数行及列设置不同背景颜色的方法,以此增强表格的可读性和美观性。

被折叠的 条评论
为什么被折叠?



