2 replies [Last post]
wchung
Offline
newbie
Last seen: 15 years 43 weeks ago
Joined: 2004-10-17
Posts: 2
Points: 0

I have specified a color for a, a:hover, a:visited for most parts of my site. However, there are menu bars for which I would like to make the links a different color. How would I specify that?

I have tried creating a div but have not been able to figure out what commands to use within a div tag to change the "a" color.

Thanks.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 days 8 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Different color for hyperlink text in special menu division

Hi wchung,
If the other links aren't within a div you can use

div a {color:red;} 
div a:visited{color:green;} 
div a:hover{color:blue;}
or whatever color you like.
If all your links are within div's then you need to find a way to separate the ones you want to be different, class or id could help here.

There are other things that could be causing problems with links such as specificity, and the order of the pseudo classes( Link, Visited, Hover, Active).
Specificity is used to decide which style should be applied when more then one target an element. The more specific the style is the more likely the style will be applied.

Hope that helps

wchung
Offline
newbie
Last seen: 15 years 43 weeks ago
Joined: 2004-10-17
Posts: 2
Points: 0

Different color for hyperlink text in special menu division

Tony,

Thanks. I've seen other explanations on how to do it but couldn't figure it out until reading yours. The whole idea of creating a separate style notation apart from the main div#menu didn't sink in until now.

Works great!

Thanks a bunch for digging me out of a real pit.