Andrey Lima Ramos
Andrey Lima Ramos

Reputation: 79

How can I chage the color of the link in Html.Action link, when the mouse is over the div?

I am using MVC3. I have a table and an Html.ActionLink inside of it. I have already set the text decoration for none, but the link is still blue. I change the table:hover background-color and the color(of the text), and when I put the mouse over the row, the text that are not a link gets white, but the link still blue. If I change the a:hover, the link gets white just when I put the mouse over it, and not just over the row.

Is there a way to do that with css?

Upvotes: 0

Views: 1395

Answers (2)

Starx
Starx

Reputation: 78971

Typically, to cover all the anchors when you are hovering over the row.

#tableid tr:hover a {
    /* Your Styles */
}

But this does not work on all IE browser so, use JS to catch the event and apply styles to anchors in it.

Upvotes: 1

r3bel
r3bel

Reputation: 1370

use the following css:

#yourTableId:hover a {
    color: #FFF;
}

you can replace #yourTableId also with table and / or .yourTablesClass depending on where the css should be used ;)

this works also for child elements e.g.:

#yourTableId div:hover a

#yourTableId tr:hover a

so in general we can say you can use the following:

#yourTableId *:hover a

where * is a tagname, classname or id (dont forget class and id prefixes -> .classname and #idname)

here a jsfiddle example

Upvotes: 1

Related Questions