2017-02-19 108 views
0

enter image description hereCSS - 欲处理的表格单元格的背景颜色

上面的照片是用数据的表,我想处理每个表格单元的背景色。 我想留下两个表格行并更改下一个单元格的背景颜色。

如何处理这与CSS

+0

这是你想要的吗? 'tr:nth-​​child(偶数){background:#CCC} tr:nth-​​child(odd){background:#FFF}' – Flink

+1

您是否阅读过[''nth-of-type'文档] ://developer.mozilla.org/en-US/docs/Web/CSS/:第n-的型)?你应该能够想出一个简单的解决方案。 – Xufox

回答

4

这里是一个解决方案:

table tr { 
    background: #FFF; 
} 
table tr:nth-child(4n), table tr:nth-child(4n-1) { 
    background: #999; 
} 
相关问题