CSS animation 属性

2026-01-24 11:16:39 天梯榜单

CSS animation 属性

all

animation-delay

定义和用法

animation 属性是一个简写属性,用于设置六个动画属性:

animation-name

animation-duration

animation-timing-function

animation-delay

animation-iteration-count

animation-direction

注释:请始终规定 animation-duration 属性,否则时长为 0,就不会播放动画了。

另请参阅:

CSS3 教程:CSS 动画

HTML DOM 参考手册:animation 属性

实例

使用简写属性,将动画与 div 元素绑定:

div

{

animation:mymove 5s infinite;

}

亲自试一试

CSS 语法

animation: name duration timing-function delay iteration-count direction;

描述

animation-name

规定需要绑定到选择器的 keyframe 名称。

animation-duration

规定完成动画所花费的时间,以秒或毫秒计。

animation-timing-function

规定动画的速度曲线。

animation-delay

规定在动画开始之前的延迟。

animation-iteration-count

规定动画应该播放的次数。

animation-direction

规定是否应该轮流反向播放动画。

animation-fill-mode

规定动画在执行时间之外应用的值。

animation-play-state

规定动画是正在运行还是暂停。

技术细节

默认值:

none 0 ease 0 1 normal

继承性:

no

版本:

CSS3

JavaScript 语法:

object.style.animation="mymove 5s infinite"

浏览器支持

表格中的数字注明了完全支持该属性的首个浏览器版本。

带 -webkit-、-moz- 或 -o- 的数字表示使用前缀的首个版本。

Chrome

IE / Edge

Firefox

Safari

Opera

Chrome

Edge

Firefox

Safari

Opera

43.04.0 -webkit-

10.0

16.05.0 -moz-

9.04.0 -webkit-

30.015.0 -webkit-12.0 -o-

all

animation-delay

中国哪些应用被封?最新封锁列表(2025)与最快的解锁方法指南
世界杯主持夹手机事件引发热议:专业与娱乐的边界在哪里?