animation-fill-mode

Determines how an element should look before the animation starts and after it finishes. 'forwards' is the most common use, as it keeps the final frame of the animation visible.

It is documented as part of the CSS Animations specification.

/* Usage Example */
.entrance {
  animation: slide-in 1s;
  /* Keeps the element at its final position instead of resetting */
  animation-fill-mode: forwards;
}

/* Global values */
animation-fill-mode: inherit;
animation-fill-mode: initial;
animation-fill-mode: revert;
animation-fill-mode: revert-layer;
animation-fill-mode: 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