
主要就给大家介绍用css3实现图片自动循环360旋转的具体方法
css可以使用transform 属性设置元素进行旋转、缩放、移动或倾斜。
我们可以使用css样式transform:rotate(360deg)设置元素旋转360度。
可以使用animation设置动画属性。可以通过animation-duration属性设置动画时长。
css3可以通过设置元素css样式为transform:rotate(360deg)设置元素旋转角度为360度,然后通过animation-duration属性来设置动画时长即可实现元素不停旋转。
示例:
HTML代码:
<div class="demo"> <img class="an img" src="1.webp" width="200" height="200"/>
css图片旋转360度的动画代码示例如下:
.demo{text-align: center;
margin-top: 100px;}
@-webkit-keyframes rotation{
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
.an{
-webkit-transform: rotate(360deg);
animation: rotation 3s linear infinite;
-moz-animation: rotation 3s linear infinite;
-webkit-animation: rotation 3s linear infinite;
-o-animation: rotation 3s linear infinite;
}
.img{border-radius: 200px;}效果图:

以上就是css3如何设置元素不停旋转?的详细内容,更多请关注易知道|edz.cc其它相关文章!














