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 trialRadu Zurbau
501 Pointsnav a.selected {} vs. .social-icon and .profile photo
We selected the .selected class in CSS by stating the nav a in from of it yet we did not use the exact path in case of .social icon and .profile-photo. How come the first does not get styled without the path (nav a) but the others do?
2 Answers
Julian Aramburu
11,368 PointsHi! It's all about specificity. In fact if you target .selected you would actually modifiy every other element that share the class "selected" (including the actual a element) but in this case you only want to apply that styling to your nav a elements with the class "selected". That's why you use the full path in that case and you only target the specific class in the other case.
Radu Zurbau
501 PointsGreat Answer! Thank you!!!