如何使用CSS更改tr元素中链接的文本颜色 [英] How to change text color for link in tr element with CSS

查看:368
本文介绍了如何使用CSS更改tr元素中链接的文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当鼠标悬停在表格的一行上时,我想更改背景和文本的颜色:

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;
}

如果 tr 元素,但是当链接元素存在时,链接颜色保持黑色(因为 a {color:#000;} ?)。当鼠标悬停在 tr 上时,如何在CSS中指定链接在 tr 元素中的链接的颜色?

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?

推荐答案

如何

tr:hover a {
    color: #CC0000;
}

这是您要寻找的吗?

这篇关于如何使用CSS更改tr元素中链接的文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆