在悬停时更改FontAwesome图标的字体颜色吗?

时间:2019-02-21 23:49:08

标签: css font-awesome

我正在使用FontAwesome。我在图标旁边有一个包含一些文本的标题。

当用户将鼠标悬停在文本或图标上时,我希望文本颜色和图标颜色同时转变为黑色。

我可以更改文本颜色,但不能更改图标颜色,而且我不知道为什么不这样做。

这是我的代码:

      .help-header {
        color: red;
        cursor: pointer;
        transition: color 0.5s;
      }
      .help-header .fas {
        color: red;
        font-size: 16px;
        transition: color 0.5s;
      }
      .help-header:hover {
        color: black !important;
      }
<link href="https://use.fontawesome.com/releases/v5.7.2/css/fontawesome.css" rel="stylesheet"/>
<link href="https://use.fontawesome.com/releases/v5.7.2/css/solid.css" rel="stylesheet"/>
<h4 class="help-header">
Help <i class="fas fa-question-circle"></i>
</h4>

0 个答案:

没有答案
相关问题