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

HTML How to Make a Website Styling Web Pages and Navigation Polish the Navigation and Footer

Richard Rodis
Richard Rodis
1,112 Points

Can't get navigation hover change color to work

I have this piece of code

 <nav>
        <ul>
         <li> <a href= "FAMILY.HTML" class="selected">Family</a> </li>

          <li> <a href= "PETS.HTML" class="selected"> Pets</a> </li>

          <li> <a href= "FOOD.HTML" class="selected"> Food</a> </li>

        </ul>

     </nav>

and

nav a.selected, nav a: hover {
  color: #32673f
}

But nothing happens when I hover over those navigation tabs?

How can I get it to work?

1 Answer

Dwayne Pate
Dwayne Pate
12,249 Points

To get a link to change color when hovering you need to remove the space-

nav a:hover {

In your code, you are setting the link color and the hover color to the same, so you won't see a change, even if removing the space.

Try this instead-

nav a:hover { color: #32673f }