underline on hover

hi,

I have a few css styles.  What I'm trying to achieve is to underline and show a different colour when the user hovers over the link.  Here's the css styles which i've attached to the links on the page.

.ms-nav{
font-family: tahoma;
font-size: 9pt;
color: #636363
}

.ms-nav a{
font-family: Tahoma;
Color: #636363;
font-size: 9pt;
text-decoration: none;
}

.ms-nav a:hover{
font-family: tahoma;
font-size: 9pt;
color: #AE0A38;
}

.ms-nav a:link{
color: #AE0A38;
text-decoration: underline;
font-family: Tahoma;
font-size: 9pt;
}

.ms-nav a:visited{
font-family: Tahoma;
font-size: 9pt
}

in my href i have the following:

<a class=ms-nav href="url goes here">

Thanks
mitesh114Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RoonaanCommented:
You can edit your .ms-nav a:hover class to hold
a.ms-nav {
font-family: Tahoma;
color: #636363;
font-size: 9pt;
text-decoration: none;
}

a.ms-nav:link{
color: #AE0A38;
}
a.ms-nav:visited{
}

a.ms-nav:hover{
color: pink;
text-decoration: underline;
}

You have font-size and font-family defined in the .ms-nav class, so you don't need to define it in every subclass.

-r-

mitesh114Author Commented:
Roonaan,

You have put a.ms-nav and I have .ms-nav a, does this make a difference?

I tried your suggestion and it doesn't highlight the links when hovered over.  I am using this in Sharepoint; does this make any difference?  I am modifying the classes via themes in frontpage.  

Regards
SheharyaarSaahilCommented:
Normally we use a:link, a:visited and a:hover styles for ALL the links present on the page.
but if you want to use different hover behaviours for different links, you can use the following type of style sheets

a:link {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
a:visited {
    text-decoration: none;
}
a.ms-nav:link {
    text-decoration: none;
    color: #666666;
}
a.ms-nav:visited {
    color: #666666;
    text-decoration: none;
}
a.ms-nav:hover {
    color: #CC0000;
    text-decoration: underline;
}

NOTE: always use link, visited and hover in the proper order, means first A:LINK, second A:VISITED and thrid A:HOVER

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

SheharyaarSaahilCommented:
a test page,

===============

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
a:link {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
a:visited {
    text-decoration: none;
}
a.ms-nav:link {
    text-decoration: none;
    color: #666666;
}
a.ms-nav:visited {
    color: #666666;
    text-decoration: none;
}
a.ms-nav:hover {
    color: #CC0000;
    text-decoration: underline;
}
-->
</style>
</head>

<body>
<p><a href="http://www.google.com">Google</a></p>
<p><a href="http://www.yahoo.com" class="ms-nav">Yahoo</a></p>
</body>
</html>

=========================
RoonaanCommented:
@mitesh114,

Yes it matter whether you use .ms-nav a:link or a.ms-nav:link. The first one will not work because that rules looks for a link element which is a child element with class-name "ms-nav". The second one looks for a link with class-name "ms-nav".

@SheharyaarSaahil,

>NOTE: always use link, visited and hover in the proper order, means first A:LINK, second A:VISITED and thrid A:HOVER

>a test page,
..
> a:link {
> a:hover {
> a:visited {
SheharyaarSaahilCommented:
yeah my mistake....sorry
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.