Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS The Selectors Solution

main a:hover not working please help!

I input the color value for main a:hover exactly as shown in the video, but it won't work when I launch the page. Any idea why? I opened the inspector on the webpage and the color property and its value were crossed out. I thought perhaps the browser wouldn't render the tomato color so I tried changing it to a simple red, but it still wouldn't work. I have no idea why this is...

Hi nicolaspeterson ,Can you show your code?Thanks

1 Answer

I had the same issue, but then i solved it by putting the 'main a: visited' rule above the 'main a: hover' rule in my stylesheet.

like this: main a:visited { color: red; }

main a:hover{ color: aqua; }

Here is a quote i found from the MDN docs. "To style links appropriately, put the :visited rule after the :link rule but before the :hover and :active rules, as defined by the LVHA-order: :link — :visited — :hover — :active."

MDN :visited rule doc - https://developer.mozilla.org/en-US/docs/Web/CSS/:visited