Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

How popular is Adjacent Sibling Selector in CSS?

Just finished some CSS courses and im wondering, how popular is Adjacent Sibling Selector? Are You guys using it pretty often or its better to go with classes and id's? What about compatibility with different browsers?

1 Answer

As with most things in programming, it depends. I think it's often a better choice to use a CSS selector over adding a non-semantic class. As a general rule of thumb if you can select the desired element with 3 or less parts in your selector you should consider using CSS.

The adjacent sibling selector is CSS2, so it's supported most everywhere.