css实现div一直旋转的方法:首先创建一个div元素,并给它一个id值;然后使用内联样式给div添加一些样式;接着使用“@keyframes”规则创建一个动画rotate;最后给div指定animation即可。

本教程操作环境:windows7系统、HTML5&&CSS3版本,Dell G3电脑。
相关推荐:《css视频教程》
css实现div一直旋转
1、首先创建一个div元素,并给它一个id值xuanzhuan,使用内联样式给div添加一些样式。
立即学习“前端免费学习笔记(深入)”;
2、然后使用@keyframes规则创建一个动画rotate
@-webkit-keyframes rotate{ from{-webkit-transform: rotate(0deg)} to{-webkit-transform: rotate(360deg)} } @-moz-keyframes rotate{ from{-moz-transform: rotate(0deg)} to{-moz-transform: rotate(359deg)} } @-o-keyframes rotate{ from{-o-transform: rotate(0deg)} to{-o-transform: rotate(359deg)} } @keyframes rotate{ from{transform: rotate(0deg)} to{transform: rotate(359deg)} }3、最后,给div指定animation即可。
#xuanzhun{ -webkit-transition-property: -webkit-transform; -webkit-transition-duration: 1s; -moz-transition-property: -moz-transform; -moz-transition-duration: 1s; -webkit-animation: rotate 3s linear infinite; -moz-animation: rotate 3s linear infinite; -o-animation: rotate 3s linear infinite; animation: rotate 3s linear infinite; }效果:
相关文章
css 想快速实现卡片组件样式怎么办_使用 css tailwind 预设组件类实现
css 响应式网页中卡片高度不一致怎么办_通过统一内容结构实现稳定布局
css 想给表格隔行设置不同颜色怎么办_nth-child 配合 background-color
css currentcolor 是什么颜色值_利用继承机制说明颜色取值规则
css 垂直居中布局_使用 flexbox 和 grid 实现元素垂直居中
相关标签:
本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
更多热门AI工具












