简体   繁体   中英

How to change text color for link in tr element with 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 ?

How about

tr:hover a {
    color: #CC0000;
}

is this what you are looking for ?

Try

tr a{
  color:#000;
}

tr a:hover {
  color:#FFF;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM