Fill mode

Also called animation-fill-mode or fill-mode forwards

A CSS setting that decides which styles an element shows before a delayed animation starts and after the animation ends.

Fill mode explained

By default, a CSS animation only affects an element while it is running. During an animation-delay the element shows its normal styles, and when the animation ends it snaps back to them. animation-fill-mode changes that.

forwards keeps the styles of the last keyframe after the animation ends. backwards applies the first keyframe during the delay, so a delayed fade-in stays hidden instead of showing and then vanishing. both does both, and it is the usual choice for delayed entrance animations.

With forwards, the finished animation keeps control of the properties it animated, so changing them later in normal CSS appears to do nothing. For a lasting state change, set the final style on the element and animate toward it. The Web Animations API calls the same setting fill.

All terms

Delay

The wait between the moment an animation is triggered and the moment it starts moving, used to sequence motion or ignore brief triggers.

Keyframes

Snapshots that define how an element looks at set points in an animation. The browser fills in the motion between them.

Fade in

An entrance animation where an element goes from fully transparent to fully visible, so it appears gently instead of popping in.

Stagger

Animating a group of items one after another with a small delay between each, so they arrive as a cascade.