I'm currently working on a website that was designed by someone else... someone without a good grasp of CSS. I'm suspecting her code is at work here.

Basically, there's a very simple a:hover that works... but inconsistently, and not in any sort of logical sense. Some elements will hover fine, others won't. This is only for standard links, and should apply to ALL links across the website (she's done her CSS declarations in the header rather than a separate file, but I'm going to fix that later. For now, though, I want this code working before I break it out and apply it site-wide.

IE renders almost none of it, firefox renders some. Chrome properly hovers only two links, the "podcast" link and the "2. Survive" link. Can you help me clean up this mess of code? I'm fine with CSS when I write it, but I have trouble debugging someone else's.

I believe this was designed on a Mac/for Safari, and was not tested by the original designer in any other browsers. These flaws appeared only after I took over and tried to implement them.

2 answers

This was chosen as the best answer
   a:link {color:white; text-decoration:none}
    a:hover {color: #8F9844; text-decoration:none}
    a:visited {color:white; text-decoration:none}

is in the wrong order.


 a:link {color:white; text-decoration:none}
 a:visited {color:white; text-decoration:none}
 a:hover {color: #8F9844; text-decoration:none}

and it will work.

The visited declaration over-rides the hover, so any links that have been visited stop changing on hover.

The order has a mnemonic LoVeHAte Link,Visited,Hover,Active

but that forgets the :focus possibility.

so this one:

Lord Vader, Former Handle Anakin

Deals with that...

more: http://reference.sitepoint.com/css/pseudoclasses

Answered almost 9 years ago by Tony Crockford

Excellent. That did the trick. You are a lifesaver. I KNEW it had to be something simple. Thank you SO much!

Answered almost 9 years ago by Heather
  • You should just be commenting on the answer, not adding an answer to your question as a comment. This site doesn't function like a forum where things are kept in the order that the replies came in. Charles Boyung almost 9 years ago