tags:

views:

133

answers:

3

I have an aspx page with a Masterpage containing a panel with a CssClass of "menutoolbar". Within that panel I am placing objects, in this case a linkbutton with a class of "SearchLink".

In my Stylesheet, I am defining

.menutoolbar a:hover { color: red }

.Searchlink a:hover { color: yellow }

When I hover over the Searchlink link it is red! This is not what I expect, the Searchlink specifically is defined as yellow, it looks like the parent container "menutoolbar" is overriding the color, reverse of what I would expect.

How can I make the hover effect yellow for Searchlink?

+3  A: 

try doing:

.Searchlink a:hover { color: yellow!important; }

if the link class is "searchlink" you could try

a.Searchlink:hover { color: yellow; }
Jason
Hmm, didn't work.
Mark Kadlec
post your html please
Jason
The second one worked. Thanks!
Mark Kadlec
I would recommend against blindly using !important as a patch without fully understanding the problem
Marius Gedminas
+4  A: 
a.Searchlink:hover { color: yellow }
Daniel A. White
Perfect, thanks!
Mark Kadlec
Please accept and/or vote up my answer.
Daniel A. White
You beat me to it :)
Ciaran Archer
+1  A: 

Alternatively you can be more specific with the rule, e.g.

a.Searchlink:hover { color: yellow;}

Or something like that.

Ciaran Archer