PDA

View Full Version : Link hover reset.



optimus203
Dec 1st, 2008, 12:47 AM
Hey everyone. One a link/internal page has been visited through a hyperlink, is there a way to reset the values so that the hover values show up again, instead all the visited links staying in the visited state? It's visually displeasing when some of the links still display the hover state while others do not. Any help is greatly appreciated.

Here is my simple css code for all the hyperlinks:


a:link {color:#0000CB; text-decoration:none;}
a:hover {color:#999999; text-decoration:underline;}
a:active {color:#3333ff; text-decoration:none;}
a:visited {color:#0000CB; text-decoration:none;}

GardenGnome2
Dec 1st, 2008, 01:54 AM
Add another line that says


a:visited:hover {color:#999999; text-decoration:underline;}

optimus203
Dec 1st, 2008, 02:05 AM
Perfect! I didn't know you could do that. Thanks Garden Gnome. I really appreciate it.

Arbitrator
Dec 1st, 2008, 06:24 AM
Perfect!You could have also just changed the order of your style rules. :visited is overriding :hover because it appears later in the style sheet; putting :hover after visited will cause :hover styles to take precedence.

You could also shorten your code a bit; the following code should do pretty much the same thing.


a {color: #0000cb; text-decoration: none; }
a:hover { color: #999; text-decoration: underline; }
a:active { color: #33f; text-decoration: none; }

Major Payne
Dec 1st, 2008, 08:49 AM
Links MUST be in correct order:

a:link {color:#0000CB; text-decoration:none;}
a:visited {color:#0000CB; text-decoration:none;}
a:hover {color:#999999; text-decoration:underline;}
a:active {color:#3333ff; text-decoration:none;}

link | visited | hover | active

Apostropartheid
Dec 1st, 2008, 05:50 PM
Links MUST be in correct order:
Well, no, they mustn't, but that's the way to do it so they don't override each other in a displeasing fashion.

*opens bag of coder tricks* There's a little mnemonic some like to use: love hate (you can see the gangster's fingers right now)