/* 定义一个简单的 CSS 动画并使其循环播放 */
@keyframes example {
0% { background-color: red; }
25% { background-color: yellow; }
50% { background-color: blue; }
75% { background-color: green; }
100% { background-color: red; }
}
/* 应用动画到元素,并设置动画无限循环 */
div {
width: 100px;
height: 100px;
animation-name: example;
animation-duration: 4s;
animation-iteration-count: infinite; /* 设置动画无限循环 */
}
@keyframes example
:定义了一个名为 example
的动画,通过不同的百分比设置了背景颜色的变化。animation-name: example
:将定义的动画应用到 div
元素上。animation-duration: 4s
:设置动画的持续时间为 4 秒。animation-iteration-count: infinite
:使动画无限循环播放。上一篇:css背景颜色渐变
下一篇:cssdisplay属性
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站