CSS3动画旋转——(图片360°旋转)

时间:2020-07-28 14:44:30   收藏:0   阅读:164

今天在重构网页特效的时候,想着用到一个css3的旋转特效。简单来一个demo。

html

 <div class="box">
    <img src="./yft.png" alt="" class="rotation">
  </div>

css

  <style>
    @-webkit-keyframes rot {
      from {
        -webkit-transform: rotate(0deg);
      }
      to {
        -webkit-transform: rotate(360deg);
      }
    }
    .rotation {
      animation: rot 3s linear infinite;
    }
  </style>

注意的是,建议这里使用的是插入图片,如果用背景图片的话,那么盒子内的内容也会进行旋转。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!