Definition and Usage
The animation-iteration-count CSS property defines the number of times an animation cycle should be played before stopping.
It is often convenient to use the shorthand property animation to set all animation properties at once.
- Initial 1
- Applies to all elements, ::before and ::after pseudo-element
- Inherited no
- Media visual
- Computed Value as specified
- Animatable no
- Canonical order the unique non-ambiguous order defined by the formal grammar
Syntax
Formal syntax: <single-animation-iteration-count>#
animation-iteration-count: infinite animation-iteration-count: 3 animation-iteration-count: 2.3 animation-iteration-count: 2, 0, infinite
Values
- infinite
- The animation will repeat forever.
- <number>
- The number of times the animation should repeat; this is 1 by default. Negative values are invalid. You may specify non-integer values to play part of an animation cycle (for example 0.5 will play half of the animation cycle).
Examples
See CSS animations for examples.Compatibility
Desktop browsers
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | (Yes)-webkit | 5.0 (5.0)-moz 16.0 (16.0) | 10 | 12 -o 12.10 | 4.0-webkit |
Mobile browsers
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | (Yes)-webkit | 5.0 (5.0)-moz 16.0 (16.0) | NA | NA | NA |