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

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.