我是关于设计表格的。我希望每个奇数行都有一个特定的背景,除了包含标题的第一行。
我使用了以下不起作用的代码:
.new-items-table tr:nth-of-type(odd):not(.new-items-table tr):nth-of-type(1)
{
background-color: red;
}
最佳答案
你可以这样做:
.new-items-table tr:nth-child(2n + 3) {
background-color: red;
}
2n + 1
与 odd
相同。 2n + 3
跳过前两行。
关于html - 如何使用:not selector with :nth-of-type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18298999/