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.

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:

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
InheritedNo
JavaScript Usageelement.style.animationIterationCount = “infinite”

Author

  • Manoj Kumar

    Hi, My name is Manoj Kumar. I am a full-stack developer with a passion for creating robust and efficient web applications. I have hands-on experience with a diverse set of technologies, including but not limited to HTML, CSS, JavaScript, TypeScript, Angular, Node.js, Express, React, and MongoDB.

Leave a Comment