Style every thing except first child

后端 未结 4 1983
眼角桃花
眼角桃花 2021-01-21 02:16

I know of the selector :not() but it doesn\'t work, like tr:not(tr:first-child):hover. I want to style the other trs but not the first one

4条回答
  •  时光说笑
    2021-01-21 03:07

    Use the adjacent sibling combinator. As a bonus, it's a bit more widely supported than :not()

    TR + TR { background-color: silver; }
    TR + TR:hover { background-color: green; }
    

    http://jsfiddle.net/ETYQN/2/

提交回复
热议问题