English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
CSS animation-The delay attribute defines when the animation starts playing (for example: the value of2s, indicating that the animation will start playing after the application2starts playing after 0 seconds. The value of this property can be specified in seconds (s) or milliseconds (ms).
The following table summarizes the usage context and version history of this property.
Default value: | 0s |
---|---|
Applies to: | All elements ::before and ::after 伪元素 |
Pseudo-element | Inheritance: |
No | Animatable:No See also. |
Animation Attribute | CSS3Version: |
new feature | JavaScript Syntax: object2object.style.animationDelay=" |
Syntax of delay usage
animation-The syntax of this attribute is as follows:
delay: time | initial | inherit-The following example demonstrates how to use animation
Example .box { 5height: width: 5height: 0px; background: red; /* s; */ -webkit-animation-position: relative; -webkit-animation-name: moveit; 4delay: -webkit-animation-duration: 2delay: animation-position: relative; animation-name: moveit; 4delay: animation-duration: 2delay: 0%;} /* s; */ Chrome, Safari, Opera-webkit-@ @keyframes moveit { from {left: 0;} 5to {left: 0%;} keyframes moveit { @keyframes moveit { from {left: 0;} 5to {left: 0%;}}/Test to see‹
›Note:-2A negative value for the animation delay causes the animation to start immediately, but it seems to start in the middle of its animation cycle, for example2starts executing after a certain number of seconds.
The following table describes the values of this attribute.
Value | Description |
---|---|
time | Define the number of seconds or milliseconds to wait before the animation starts. The default value is 0s. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element adopts its parent element's animation-The calculated value of the delay attribute. |
animation-Browser Compatibility of delay Attribute, all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS3Animation.
Related Attributes and Rules:animation,animation-name,animation-duration,animation-timing-function,animation-iteration-count,animation-direction,animation-fill-mode,animation-play-state,@keyframes.