简体   繁体   English

更改字体真棒图标在悬停时旋转和缩放

[英]change font awesome icon rotate and scale in on hover

I have some static font awesome icons and I would like them each to change with some nice affect when a user hovers over them ie rotate a small bit and also pop out.我有一些静态字体很棒的图标,我希望当用户将鼠标悬停在它们上方时,它们每个都会发生一些很好的变化,即旋转一点并弹出。 What is the easiest way to achieve this?实现这一目标的最简单方法是什么?

They currently look like this:它们目前看起来像这样:

在此处输入图片说明

My current icons:我当前的图标:

 <div class="it-icons">
                  <a target="_blank" href="https://www.linkedin.com/in/craig-whelan-515704196/">
                    <i class="fab fa-linkedin-in"></i>
                  </a>
                  <a target="_blank" href="https://github.com/craig1990">
                    <i class="fab fa-github"></i>
                  </a>
                  <a target="_blank" href="https://stackoverflow.com/users/12231949/darego101">
                    <i class="fab fa-stack-overflow"></i>
                  </a>
                </div>

CSS: CSS:

.it-icons a {
  display: inline-block;
  height: 3.5rem;
  width: 3.5rem;
  background-color: #4582EC;
  color: #fff !important;
  border-radius: 100%;
  text-align: center;
  font-size: 1.5rem;
  line-height: 3.5rem;
  margin-right: 1rem;
}

 .it-icons a { display: inline-block; height: 3.5rem; width: 3.5rem; background-color: #4582EC; color: #fff !important; border-radius: 100%; text-align: center; font-size: 1.5rem; line-height: 3.5rem; margin-right: 1rem; transform: scale(1); transition: all ease .3s; } .it-icons a:hover{ transform: scale(1.15) rotate(25deg); }
 <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> <div class="it-icons"> <a target="_blank" href="https://www.linkedin.com/in/craig-whelan-515704196/"> <i class="fab fa-linkedin-in"></i> </a> <a target="_blank" href="https://github.com/craig1990"> <i class="fab fa-github"></i> </a> <a target="_blank" href="https://stackoverflow.com/users/12231949/darego101"> <i class="fab fa-stack-overflow"></i> </a> </div>

You can try doing something like this, it's simple and it's not too flashy.你可以尝试做这样的事情,它很简单,也不会太花哨。 In my opinion there shouldn't be any complicated animations on the site or if there are they should be kept to the minimum.在我看来,网站上不应该有任何复杂的动画,或者如果有,它们应该保持在最低限度。 Hope this helps you.希望这对你有帮助。

     .it-icons a {
        display: inline-block;
        height: 3.5rem;
        width: 3.5rem;
        background-color: #4582EC;
        color: #fff !important;
        border-radius: 100%;
        text-align: center;
        font-size: 1.5rem;
        line-height: 3.5rem;
        margin-right: 1rem;
        transition: transform 0.5s ease-in-out;
        transition: 1s;
    }

    .it-icons a:hover {
        transform: rotate(360deg);
        background-color: rgb(7, 63, 161);
    }

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

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