【问题标题】: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】:

    使用&lt;i&gt;作为图标并用&lt;a&gt;这样包裹它:

    <tr>
        <td a href="#">Test</td>
        <td><a href="#"><i class="glyphicon glyphicon-cog"></i></a></td> 
    </tr>
    

    【讨论】:

      猜你喜欢
      • 2016-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-04
      • 2020-10-06
      • 1970-01-01
      • 2020-08-14
      • 1970-01-01
      相关资源
      最近更新 更多