【问题标题】:Font Awesome Icons change color on hover without animation字体真棒图标在没有动画的情况下在悬停时改变颜色
【发布时间】:2019-01-16 12:29:09
【问题描述】:

我遇到了字体真棒图标在没有动画的情况下在悬停时更改颜色的问题。当用户将鼠标悬停在图标上时,我希望图标改变它的颜色以改变靛蓝、蓝色和红色,而不会从底部出现彩色图标的动画(忘记了动画类型名称)。

<div class="clearfix">
    <a href="#" class="btn btn-icon btn-social btn-sm white no-radius no-borders">
        <i class="fa fa-facebook" aria-hidden="true"></i>
        <i class="fa fa-facebook indigo" aria-hidden="true"></i>
    </a>
    <a href="#" class="btn btn-icon btn-social btn-sm white no-radius no-borders">
        <i class="fa fa-twitter" aria-hidden="true"></i>
        <i class="fa fa-twitter blue" aria-hidden="true"></i>
    </a>
    <a href="#" class="btn btn-icon btn-social btn-sm white no-radius no-borders">
        <i class="fa fa-google-plus" aria-hidden="true"></i>
        <i class="fa fa-google-plus red" aria-hidden="true"></i>
    </a>
</div>

非常感谢您的帮助。

注意:我已经检查过Change color when hover a font awesome icon?

【问题讨论】:

  • 你可以设置你的animation: nonetransition: none
  • @Blackheart transition: none 工作,非常感谢!
  • 让我在这里分享解决方案:.fa-facebook, .fa-twitter, .fa-google-plus { transition: none; }

标签: html css bootstrap-4


【解决方案1】:

试试这个 Css 代码。

.fa-facebook, .fa-twitter,.fa-google-plus {
 -webkit-transition-property: none;
 -moz-transition-property: none;
 -o-transition-property: none;
 transition-property: none;
  animation-name: none;
}


.fa-facebook:hover, .fa-twitter:hover,.fa-google-plus:hover {
 color: indigo;
 -webkit-transition-property: none;
 -moz-transition-property: none;
 -o-transition-property: none;
 transition-property: none;
  animation-name: none;
}

【讨论】:

  • 非常感谢您的回答!我将在未来考虑这种解决方案。但是,对于这个来说,它似乎是很多行代码。 . .fa-facebook, .fa-twitter, .fa-google-plus{ transition: none; } 解决了这个问题。
  • 是的。 Blackheart 上面transition: none; 的评论解决了这个问题。谢谢你:)
猜你喜欢
  • 2014-11-04
  • 2016-04-08
  • 2017-10-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-26
  • 2020-01-11
  • 2022-07-06
相关资源
最近更新 更多