我有一个带有CSS3交替行样式的表格,但我需要覆盖一些行的样式。
下面是表格的CSS:
table.primary tr:nth-child(odd) {
background-color: #e5e5e5;
}
table.primary tr:nth-child(even) {
background-color: #ededed;
}
我需要覆盖一些具有非常不同背景颜色(和其他格式)的行,我希望只需向每个行添加class=
,但似乎这并没有覆盖上面的 CSS。
例如:
<table class="primary">
<tr><td>one</td></tr>
<tr class="new"><td>two</td></tr>
<tr><td>three</td></tr>
</table>
或者我需要跳过CSS3,只是使用 class="row1"
,class="row2"
和 class="new"
。
有没有关于如何使用类覆盖 nth-child
的建议?