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 The Selectors Solution

4,015 Points

One little nav detail made or break it I'm lost

ul li { color:tomato; }

nav a { text-docration:none }

nav a:hover { color:orange; }

.link:visited { color:red; }

.link:hover { color:green; } This code works fine -----------

ul li { color:tomato; }

a { text-docration:none

a:hover { ------- HERE if i remove nav here so it's a{ everything before and after turns out to be the same as how it was before i started writing code in this challange. color:orange; }

.link:visited { color:red; }

Question: why is the nav in nav a:hover {} so importent that it ruin the hole code?


1 Answer

Steven Parker
Steven Parker
229,644 Points

The Container part ("nav") of your descendant selector restricts the rule to only the anchors that are inside that container. Without that, the rule applies to every anchor on the entire page, which is probably not what is needed.