Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change text color for link in tr element with CSS

Tags:

html

css

I'd like to change the background and text color when the mouse hovers over a row in a table:

tr {
  background-color:#FFF;
  color:#000;
}

tr:hover {
  background-color:#000;
  color:#FFF;
}

This works if there aren't any links in the tr elements, but when there are, the link color remains black (because of a { color: #000; }?). How do I specify in the CSS that links in the tr element should change color when the mouse hovers over the tr?

like image 809
user5243421 Avatar asked Apr 29 '10 06:04

user5243421


2 Answers

How about

tr:hover a {
    color: #CC0000;
}

is this what you are looking for ?

like image 179
nc3b Avatar answered Sep 24 '22 17:09

nc3b


Try

tr a{
  color:#000;
}

tr a:hover {
  color:#FFF;
}
like image 31
Salil Avatar answered Sep 24 '22 17:09

Salil