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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why a:hover does not work?

Status
Not open for further replies.

CharlieIT

MIS
Apr 9, 2003
157
US
This is driving me nuts because it HAS to be something simple! The a:hover should change the color to red when you hover over the text. It works when the color of the text is black (default), but not when the color of the text is blue (declared below).

Help!


css...

<style>
#color {
color: blue;
}
#color a:hover {
color: red:
}
</style>

html...

<div id="color"><a href="test.htm">This should turn red when you hover over it</a></div>



 
Try declaring the color of the non rollover link too.

You should do it in this order

Link, Visited, Hover, Active

If that doesn't work can you show us the rest of your CSS as it's likely something else is over-riding the rule shown.

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
You should listen to Foamcow's advice, he knows what he's talking about.

Additionally, you could change this to a semi-colon and that might help [smile]

Code:
<style>
#color {
    color: blue;
   }
#color a:hover {
    color: red:[!]<--- should be a semi-colon[/!]
   }
</style>

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
Yeah, there's that too. Thought it was a bit obvious though ;-)
<blush />

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Thanks guys. The surgeon general recommends you walk away from the computer at least once every 14 hours.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top