Search code examples
asp.netcsshoverstylesheet

Override CSS class in ASP.Net


I have CSS like this:

LinkButton:hover
{
    color:White;
    background-color:Gray;
}
.myClass
{
    color:Blue;
}

My problem is I have a linkbutton with CssClass .myClass and whenever I hovers over it, it's background colour changes but color is not turning to white, is there any way to override .myClass by LinkButton:hover ?


Solution

  • Try this

    http://jsfiddle.net/v4gsY/
    

    CSS

    .myClass:hover
    {
        color:White;
        background-color:Gray;
    }
    

    The LinkButton CSS selector will not work as it is converted to a tag.