您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

css怎么设置元素一直旋转

2024/4/3 6:34:44发布27次查看
css设置元素一直旋转的方法:首先创建一个html示例文件;然后用img引入图片;最后使用css样式“transform:rotate(360deg)”设置元素旋转360度,并通过animation-duration属性设置动画时长即可。
本文操作环境:windows7系统、html5&&css3版,dell g3电脑
我们在进行网页页面设计时,经常会遇到各种关于图片展示的问题,比如有的需要让图片圆角展示、图片点击放大展示等等效果。
主要就给大家介绍用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.jpg" width="400" height="400"/>
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;}
效果图:
推荐学习:《css视频教程》
以上就是css怎么设置元素一直旋转的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product