/    Sign up×
Reference /Pin to ProfileBookmark

animation-fill-mode

The animation-fill-mode property designates a style for the element before the animation starts, after it ends, or both.

Syntax

Since CSS animations do not affect the element before or after the first or last keyframe is played, this property can override the behavior.

div.ex {
  animation-fill-mode: backwards;
}

Values

none
Default value. No styles are applied before or after the animation is executed.

forwards
The style values that are are set by the last keyframe are retained, depending on animation-direction and animation-iteration-count.

backwards
The style values that are are set by the first keyframe are retained, depending on animation-direction, and are retained during the animation-delay period.

both
The animation will extend the animation properties in both directions.

initial
Sets the property to its default value.

inherit
Inherits this property’s value from its parent item.

Browser Compatibilty

Demos

User-submitted codepen.io examples of animation-fill-mode

@ByteAtATime

See the Pen on CodePen.

@themolitorNiiiice!

Want to Contribute?

Submit a codepen.io link that demonstrates animation-fill-mode:

to submit a demo.
CSS
×

Success!

Help @reference spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...