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 trialsteve liebenberg
1,530 PointsPlease check out my files on the practice css selector review/challenge I can't get hover to work
I can't find any errors. However, it will not hover in the main section .... can someone please look at the files?
This is the only part that isn't working: /* Create hover and visited styles for all links inside 'main' */
main a:hover { color: red; text-decoration: none; }
main a:visited { color: skyblue; }
Here is a snapshot of my files: https://w.trhou.se/zd6dnl7rf2
Thank you, Steve
2 Answers
Benjamin Larson
34,055 PointsHi Steve -
The red hover is technically working and displays correctly until those links have been visited and the hover state is then being replaced by the visited style. Order is important in defining anchor states. So hover needs to come after link and visited. You can also use the pseudo-class active for an anchor that is currently being clicked.
main a:link {
color: red;
text-decoration: none;
}
main a:visited {
color: skyblue;
}
main a:hover {
color: red;
text-decoration: none;
}
steve liebenberg
1,530 PointsThank you, Benjamin!