简体   繁体   English

CSS tr:悬停和锚标签

[英]CSS tr:hover and anchor tags

in my stylesheet, my links are styled like this: 在我的样式表中,我的链接样式如下:

a {color:#0088cc; text-decoration:none;border-bottom: 1px dotted #0088cc;}

and my tables are styled like this: 我的表格样式如下:

.datagridStyle { width: 100%; }
.datagridStyle th { color: #aaaaaa; padding: 8px 4px 8px 4px; background-color: #000000; background-image: url(/Content/Images/BarBGR.gif); }
    .datagridStyle th:hover { color: #eeeeee; background-color: #333333; }
.datagridStyle td { border-bottom: 1px solid #b7b6b6; padding: 6px; }
/* THIS STYLE IS THE ONE OF INTEREST */
.datagridStyle tr:hover { padding: 2px; background-color: #0083c4; color: #ffffff; cursor: pointer; }

problem is when I hover over a row, the row turns blue and the text turns white, but if any of the text is a link, it stays blue and hence, invisible. 问题是,当我将鼠标悬停在一行上时,该行变为蓝色,文本变为白色,但如果任何文本是链接,则它保持蓝色,因此不可见。 How do I style the a tags inside my table to change to white too when the mouse hovers over the row and turns it blue? 当鼠标悬停在行上并将其变为蓝色时,如何将表格中的标签设置为更改为白色?

Try adding: 尝试添加:

.datagridStyle tr:hover a { color: #ffffff; }

Which will style all the links in .datagridStyle tr:hover to be white as well. 这将设置.datagridStyle tr:hover所有链接的.datagridStyle tr:hover也是白色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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