【发布时间】:2019-08-02 00:27:23
【问题描述】:
我想为我的 html 表格添加一些样式,但无法在 css 中进行特定选择,我想选择每个偶数行,除了每个行的最后一列! 我已经知道如何选择每个偶数行:“:nth-child(偶数)”,但我不能让它排除最后一列!
<tr>
<td>1</td>
<td>name</td>
<td>age</td>
<td>country</td>
<td id="rmv"><button>remove</button></td>
</tr>
【问题讨论】:
-
:nth-child(even):not(:last-child)? -
@TemaniAfif 不,这使它排除了整个最后一行!我只需要从每个偶数行中排除最后一列
-
选择行并排除列?你能说得清楚点吗,对我来说没有意义
-
tr:last-child:{}现在只是覆盖范围内。 -
你添加一个空格然后
:nth-child(even) :not(:last-child)