HTML:
<table>
<tr class="not-counted"><th>Heading 1</th></tr>
<tr><td>key1</td><td>val1</td></tr>
<tr><td>key2</td><td>val2</td></tr>
<tr class="not-counted"><th>Heading 2</th></tr>
<tr><td>key3</td><td>val3</td></tr>
</table>
CSS 样式:
table tr:not(.not-counted):nth-child(even) td {
background-color: gray;
}
演示:http: //jsfiddle.net/MartyIX/fdtpL/
我希望包含 key3 的 TR 也有灰色背景,但它不起作用。如何正确编写 CSS?
谢谢!