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

My hover color stopped working in the <main> element once I visited the links. Is this normal?

main a:hover { color: tomato; text-decoration:none; }

main a:visited { color: skyblue; }

If I comment out the main a: visited selector it starts working again.

1 Answer

Steven Parker
Steven Parker
231,236 Points

When setting the style for several link states, there are some order rules:

  • a:hover must come after a:link and a:visited
  • a:active must come after a:hover

See the Styling Links page on MDN for more information.

Thanks Steven!

Yes it was the order that was messing it up, when I put the a:visited before the a:hover it worked fine.

Lazaro Medina
Lazaro Medina
1,528 Points

Thanks for this! I wonder why it worked for Guil and not me.