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 trialHeidi Fryz
12,299 PointsMy 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
231,248 PointsWhen setting the style for several link states, there are some order rules:
-
a:hover
must come aftera:link
anda:visited
-
a:active
must come aftera:hover
See the Styling Links page on MDN for more information.
Heidi Fryz
12,299 PointsHeidi Fryz
12,299 PointsThanks Steven!
Yes it was the order that was messing it up, when I put the a:visited before the a:hover it worked fine.
Michael Pashkov
22,024 PointsMichael Pashkov
22,024 PointsThank you!
Lazaro Medina
1,528 PointsLazaro Medina
1,528 PointsThanks for this! I wonder why it worked for Guil and not me.