Changing a link-style, only for a certain class

Posted by abelenky on Stack Overflow See other posts from Stack Overflow or by abelenky
Published on 2010-04-03T15:28:05Z Indexed on 2010/04/03 15:33 UTC
Read the original article Hit count: 199

Filed under:
|

I want to change the link-style for some of my links, like this:

a:hover
{
    /* These links will be blue when hovered-over */
    background-color: #3366FF;
}

However, I only want this to take effect in my Navigation Bar, and not for regular links.

I have tried variations on this:

#navbar a:hover
{
    /* These links will be blue when hovered-over */
    background-color: #3366FF;
}

With the intended meaning "this only applies to links with <div id="navbar">"
But it didn't work.

How can I set the style for only certain links, defined by the class or id of their container?

© Stack Overflow or respective owner

Related posts about css

Related posts about html