Rohit Chaudhari
Rohit Chaudhari

Reputation: 757

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 ?

Upvotes: 1

Views: 1664

Answers (3)

arunlalam
arunlalam

Reputation: 1838

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.

Upvotes: 2

Ankit Singh
Ankit Singh

Reputation: 51

try this

LinkButton:hover
{
    color:White !important;
    background-color:Gray;
}

or

a:hover
{
    color:White !important;
    background-color:Gray;
}

Upvotes: 0

Gangadhar
Gangadhar

Reputation: 1749

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

the linkbutton will render like anchor tag in the html page, so we need to write styles for a tag.

Upvotes: 1

Related Questions