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!

Different hover colours for different links

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi,

In my style sheet I have the following

a:hover {
color: #3366CC;
}
.menusub3lt {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
text-decoration: none;
line-height: 18px;
font-weight: bold;
}

I want all my links to use class menusub3lt but I want to be able to make one link turn red when I hover over it and the other turn green when I hover over it.

So far I have

<a href="link1.htm" class="menusub3lt">Link 1</a>
<a href="link2.htm" class="menusub3lt">Link 2</a>

I want to keep the hover bit in my style sheet because there are other links on the page that I want to turn that colour I just need to find a way of overriding it for specific links.
 
Why not do this:
Code:
a {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-style: normal;
    color: #666666;
    text-decoration: none;
    line-height: 18px;
    font-weight: bold;
}

a:hover {
    color: red;
}

a.mySpecialLink:hover {
    color: green;
}
Now all the links will act like they are using your class except for the link with the class mySpecialLink, that will turn green when hovered over.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top