animation-iteration-count

Sets the number of times an animation should play before stopping. You can use whole numbers (1, 2, 3) or 'infinite' for a never-ending loop.

It is documented as part of the CSS Animations specification.

/* Usage Example */
.loader {
  animation: spin 1s linear;
  /* Replays the animation forever */
  animation-iteration-count: infinite;
}

/* Global values */
animation-iteration-count: inherit;
animation-iteration-count: initial;
animation-iteration-count: revert;
animation-iteration-count: revert-layer;
animation-iteration-count: unset;
Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

43+
16+
9+
12+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC