CSS animation-iteration-count Property

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.


  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:


  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:

numberSpecify the number of times an animation should be repeated. The default value is 1, which means that the animation is played just once.
infiniteSpecify that the animation is repeated again and again(forever).
initialSets the animation-iteration-count to its default value(1).
inheritInherits the animation-iteration-count from the parent element.

General Info

Default Value1
JavaScript Usageelement.style.animationIterationCount = “infinite”