css中可利用animation-iteration-count属性来解决animate不循环问题,该属性定义动画的播放次数,只需要给动画设置“animation-iteration-count:infinite;”样式即可实现无限次循环。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
css中animate不循环,可利用animation-iteration-count属性来解决。
例如:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
div {
width: 100px;
height: 100px;
background: pink;
margin: 100px;
animation: mymove 5s;
-webkit-animation: mymove 5s; /* Safari and Chrome */
}
@keyframes mymove {
50% {
transform: rotate(360deg);
}
}
@-webkit-keyframes mymove{ /* Safari and Chrome */
50% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
立即学习“前端免费学习笔记(深入)”;
只正反旋转溢出,没有循环实现旋转,这要怎么做?简单,就利用animation-iteration-count属性来解决。
div {
width: 100px;
height: 100px;
background: pink;
margin: 100px;
animation: mymove 5s;
-webkit-animation: mymove 5s; /* Safari and Chrome */
animation-iteration-count:infinite;
-webkit-animation-iteration-count:infinite;/* Safari and Chrome */
}
说明:
使用animation-iteration-count属性定义动画的播放次数。语法:
animation-iteration-count: value;
| 值 | 描述 |
|---|---|
| n | 一个数字,定义应该播放多少次动画 |
| infinite | 指定动画应该播放无限次(永远) |
(学习视频分享:css视频教程)
以上就是css animate不循环怎么办的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号