Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hover and Visited properties of the <A> tag 1

Status
Not open for further replies.

MikeDamone

Programmer
Oct 21, 2003
106
US
It seems the Visted property takes precedence over the Hover property. I want the links to always be white unless they are hovered over, but when I set the visted property to white, the hover property no longer works for those links that I have clicked on. Is there a way around this? Here's what I have. Thanks

DIV.Menu A:hover
{
color:yellow;
}

DIV.Menu A:visited
{
color:white;
text-decoration:none;
 
Mike,

If you swap the order of the pseudo-classes, so you declare visited first, and then hover, all should be fine.

To quote the W3C website:

"Note that the A:hover must be placed after the A:link and A:visited rules, since otherwise the cascading rules will hide the 'color' property of the A:hover rule. Similarly, because A:active is placed after A:hover, the active color (lime) will apply when the user both activates and hovers over the A element.".

There is a very, very good read on selectors, which I found numerous good tips in:


Hope this helps!

Dan


Th
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top