字体图标如何在button内旋转

<button class="btn anviz-btn-primary footer-search-btn" data-class=""><i class="footer-icon icon-more_line"></i></button>
<button class="btn anviz-btn-primary footer-search-btn" data-class=""><i class="footer-icon icon-loading"></i></button>

两个字体图标分别在button内部,显示效果为:

clipboard.png

样式为:

            .footer-search-btn{
                width: 40px;
                height: 40px;
                display: inline-block;
                    vertical-align: middle;
            }
            .footer-search-btn .footer-icon{
                font-size: 24px;
                display: flex;
                justify-content: center;
            }

动画样式:

            .animated-cycle{
                -webkit-animation:rotating 1s infinite linear ;
                -webkit-transform-origin: center center;
                  -ms-transform-origin: center center;
                  transform-origin: center center;
            }
            @-webkit-keyframes rotating{
                0%{
                    -webkit-transform: rotate(0deg);
                    -moz-transform: rotate(0deg);
                    -ms-transform: rotate(0deg);
                    transform: rotate(0deg);
                }
                100%{
                    -webkit-transform: rotate(360deg);
                    -moz-transform: rotate(360deg);
                    -ms-transform: rotate(360deg);
                    transform: rotate(360deg);
                }
            }

不管我怎么写,在buuton内的字体图标都不会旋转,请问该怎么写呢?谢谢,非常感谢!

阅读 2.7k
1 个回答
<button class="btn anviz-btn-primary footer-search-btn" data-class=""><i class="footer-icon icon-loading animated-cycle"></i></button>

想的太复杂了,这样就可以实现动画了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题