在此示例中,如何选择第一个具有 notpassed 类的 tds:
<table>
<tr>
<td class="passed">1</td>
<td class="passed">2</td>
<td class="passed">3</td>
<td class="notpassed">4</td>
<td class="notpassed">5</td>
<td class="notpassed">6</td>
</tr>
<tr>
<td class="passed">04:47</td>
<td class="passed">06:22</td>
<td class="passed">13:15</td>
<td class="notpassed">20:07</td>
<td class="notpassed">20:27</td>
<td class="notpassed">00:27</td>
</tr>
</table>
tr .notpassed:first-child 不工作...
tr > .notpassed{
color: red;
/* your selected css style */
}
tr > .notpassed ~ .notpassed{
color: black;
/* your common css style */
}
<table>
<tr>
<td class="passed">1</td>
<td class="passed">2</td>
<td class="passed">3</td>
<td class="notpassed">4</td>
<td class="notpassed">5</td>
<td class="notpassed">6</td>
</tr>
<tr>
<td class="passed">04:47</td>
<td class="passed">06:22</td>
<td class="passed">13:15</td>
<td class="notpassed">20:07</td>
<td class="notpassed">20:27</td>
<td class="notpassed">00:27</td>
</tr>
</table>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句