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 trialRodrigo Barillas
452 PointsCss: Nav and Nav a
why did I have to put "Nav a" instead of only "Nav"I loaded both ways and saw the difference was only in the text color but why is that? thanks
1 Answer
Steven Parker
232,149 PointsSelecting "nav a" targets the anchor (a) elements directly, but just selecting "nav" targets the nav element itself. Depending on what property is being set, targeting the parent might work if the property is inherited — but not all properties are.
Refer to the documentation (such as on MDN) for details on specific inheritance, but as a general rule it's not only more likely to be successful but also makes your intentions clear to target the actual elements you wish to affect.