每隔 奇数 行变色一次
tr:nth-child(odd) { background-color: #eee;}每隔 偶数 行变色一次
tr:nth-child(even) { background-color: #eee;} 隔列变色每隔 奇数 行变色一次
td:nth-child(odd) { background-color: #fff065;}每隔 偶数 行变色一次
td:nth-child(even) { background-color: #fff065;} 隔行,一半为A颜色,一半为B颜色 tr:nth-child(odd) { background-color: #eee;}tr:nth-child(odd)>td:nth-child(n+5) { background-color: #fff065;}:nth-child() 选择器 中 n表示计数器,从 0 开始,a表示倍数,b表示偏移值
上一篇:table td超出宽度隐藏