CSS animation-iteration-count
property specifies how many times the animation should be repeated before it completely stops.
By default, the iteration count is set to 1, which means that the animation will be played just once.
Example:
div{ animation-iteration-count: 2; }
If we want the animation to be repeated again and again, we can set the animation-iteration-count
to infinite
. See the example below:
Example:
div{ animation-iteration-count: infinite; }
CSS Syntax
The animation-iteration-count
property has the following syntax:
animation-iteration-count: number|infinite|initial|inherit;
Property Values
The animation-iteration-count
property accepts the following values:
number | Specify the number of times an animation should be repeated. The default value is 1, which means that the animation is played just once. |
infinite | Specify that the animation is repeated again and again(forever). |
initial | Sets the animation-iteration-count to its default value(1). |
inherit | Inherits the animation-iteration-count from the parent element. |
General Info
Default Value | 1 |
Inherited | No |
JavaScript Usage | element.style.animationIterationCount = “infinite” |