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

Styling classes in css

If we have defined the class as "selected" for a link in navigation bar of our website, we write the css as "nav a.selected {}"(where a is for the anchor tag). But for a class defined inside the footer's img tag we directly write ".social-icon {}" instead of "footer img.social-icon {}". So basically my question is what is the difference between the two?

1 Answer

John Breiner
John Breiner
6,918 Points

Selected is a pseudo class and you want to make sure it's just for the link in the nav. Where as the other class you can limit it, by simply not repeating that class.