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)
.
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:
:not(:last-child) { /* styles */ }
No comments:
Post a Comment