Combining :not() selectors in CSS

前端 未结 2 597
一生所求
一生所求 2020-11-30 10:55

I\'m trying to select all tr elements inside a table, except the third and fourth. I managed to do so by using:

#table tr:not(:nth-         


        
2条回答
  •  生来不讨喜
    2020-11-30 11:41

    Although the marked answer is true I just want to point out that you can achieve what you want using css also but just in a different way. Instead of using not you can select those and unapply the stuff you don't want.

    #table tr {
        /* general case styling */
        color: blue;
    }
    #table tr:nth-child(3),
    #table tr:nth-child(4) {
        color: black;
    }
    

提交回复
热议问题