选择最后一个不确定的类元素-伪类的组合

时间:2020-01-03 01:12:50

标签: css pseudo-class

发现了一个有趣的问题,我认为应该起作用。假设我们有如下所示的html:

  <style>
        td {
            padding: 10px 20px;
        }
        tr:not(.fill):last-child {
            background-color: orange;
        }
  </style>

  <table>        
        <tr>
            <td>Row 1</td>
        </tr>
        <tr>
            <td>Row 2</td>
        </tr>
        <tr>
            <td>Row 3</td>
        </tr>
        <tr class="fill">
            <td>Row 4</td>
        </tr>    
  </table>

目的是突出显示第三行,但当前的CSS选择器不起作用。是否可以选择最后一个非“填充” tr?

0 个答案:

没有答案
相关问题