How would I select all but the last child using CSS3 selectors?
For example, to get only the last child would be div:nth-last-child(1)
.
csscss-selectors
How would I select all but the last child using CSS3 selectors?
For example, to get only the last child would be div:nth-last-child(1)
.
Best Answer
You can use the negation pseudo-class
:not()
against the:last-child
pseudo-class. Being introduced CSS Selectors Level 3, it doesn't work in IE8 or below: