CSS Tip: Adjacent Sibling Selector vs nth-child

Posted in CSS Tips
Tags: , ,

With CSS, if you need to style a specific child sibling you can use the nth-child selector:

But if you still need to support legacy browsers (IE8), you need to use a :first-child selector and an adjacent sibling selector instead:

Leave a Reply

Your email address will not be published. Required fields are marked *

*