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.

HTML Accessibility Websites CSS: Part 2

a :hover

Hi

Why doesn't the author use a :link and a :visited before they use a :hover?

I thought that was a necessary step?

Thanks Leon

Felix Yakubov
Felix Yakubov
17,475 Points

a:link and a:visited is not necessary and also not so "important" as a:hover. a:link is simply the default state and he does it with a regular a {} a:visited is how the link is displayed after you clicked it but mostly web designers use to leave it the same style as a regular link - image a huge menu where every time you click a link it changes color. a huge mess.

2 Answers

w3schools (link) says this:

Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!

So this means it only must come AFTER :link and :visited, it doesn't mean that they must be also be on the page? Correct?

Felix Yakubov
Felix Yakubov
17,475 Points

No, it means that if you want to add a:link and visited they must come before hover. Doesnt mean you have to put them.

Ok, thanks - I understand now.