【问题标题】:Change glyphicon color on row hover在行悬停时更改字形图标颜色
【发布时间】:2015-09-30 02:08:25
【问题描述】:
我试图在悬停表格行时更改字形图标颜色。以下 CSS 更改了除 glyphicon 之外的所有其他 td 的字体颜色。我正在使用引导程序 3。
CSS:
.table-custom-hover > tbody > tr:hover {
background-color: #DD4814;
color: #fff;
}
HTML:
<tr>
<td><a href="#" class="glyphicon glyphicon-cog"></a></td>
</tr>
【问题讨论】:
标签:
css
twitter-bootstrap
font-awesome
【解决方案1】:
试试这样的。目标a。
.table-custom-hover > tbody > tr:hover a,
.table-custom-hover > tbody > tr:hover {
background-color: #DD4814;
color: #fff;
}
<td><a href="" class="glyphicon glyphicon-cog"></a></td>
【解决方案2】:
使用<i>作为图标并用<a>这样包裹它:
<tr>
<td a href="#">Test</td>
<td><a href="#"><i class="glyphicon glyphicon-cog"></i></a></td>
</tr>