W3cubDocs

/CSS

animation-duration

The animation-duration CSS property sets the length of time that an animation takes to complete one cycle.

It is often convenient to use the shorthand property animation to set all animation properties at once.

Syntax

/* Single animation */
animation-duration: 6s;
animation-duration: 120ms;

/* Multiple animations */
animation-duration: 1.64s, 15.22s;
animation-duration: 10s, 35s, 230ms;

Values

<time>
The duration that an animation takes to complete one cycle. This may be specified in either seconds (s) or milliseconds (ms). The value must positive or zero and the unit is required. A value of 0s, which is the default value, indicates that no animation should occur.

Note: Negative values are invalid, causing the declaration to be ignored. Some early, prefixed, implementations may consider them as identical to 0s.

Note: When you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. For more information, see Setting multiple animation property values.

Formal syntax

<time>#

Examples

See CSS animations for examples.

Specifications

Initial value 0s
Applies to all elements, ::before and ::after pseudo-elements
Inherited no
Media visual
Computed value as specified
Animation type discrete
Canonical order the unique non-ambiguous order defined by the formal grammar
Specification Status Comment
CSS Animations
The definition of 'animation-duration' in that specification.
Working Draft Initial definition.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 43
43
3
Prefixed
Prefixed Requires the vendor prefix: -webkit-
12
12
12
Prefixed
Prefixed Requires the vendor prefix: -webkit-
16
16
49
Prefixed
Prefixed Requires the vendor prefix: -webkit-
44
Prefixed Disabled
Prefixed Requires the vendor prefix: -webkit-
Disabled From version 44: this feature is behind the layout.css.prefixes.webkit preference (needs to be set to true). To change preferences in Firefox, visit about:config.
5
Prefixed
Prefixed Requires the vendor prefix: -moz-
10 30
30
15
Prefixed
Prefixed Requires the vendor prefix: -webkit-
12.1 — 15
12 — 15
Prefixed
Prefixed Requires the vendor prefix: -o-
4
Prefixed
4
Prefixed
Prefixed Requires the vendor prefix: -webkit-
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes
Yes
2
Prefixed
Prefixed Requires the vendor prefix: -webkit-
43
43
Yes
Prefixed
Prefixed Requires the vendor prefix: -webkit-
Yes
Yes
Yes
Prefixed
Prefixed Requires the vendor prefix: -webkit-
16
16
49
Prefixed
Prefixed Requires the vendor prefix: -webkit-
44
Prefixed Disabled
Prefixed Requires the vendor prefix: -webkit-
Disabled From version 44: this feature is behind the layout.css.prefixes.webkit preference (needs to be set to true). To change preferences in Firefox, visit about:config.
5
Prefixed
Prefixed Requires the vendor prefix: -moz-
30
30
15
Prefixed
Prefixed Requires the vendor prefix: -webkit-
12.1 — 14
12 — 14
Prefixed
Prefixed Requires the vendor prefix: -o-
4.2
Prefixed
4.2
Prefixed
Prefixed Requires the vendor prefix: -webkit-
4.0
4.0
Yes
Prefixed
Prefixed Requires the vendor prefix: -webkit-

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/animation-duration