CSS animation-fill-mode Property


The animation-fill-mode property defines what values are applied by the animation outside the time it is executing. By default, an animation will not affect property values between the time it is applied (the animation-name property is set on an element) and the time it begins execution (which is determined by the animation-delay property). Also, by default an animation does not affect property values after the animation ends (determined by the animation-duration property). The animation-fill-mode property can override this behavior.

Initial value
Applies to
All elements, :before and :after pseudo elements
Computed value
As specified
JavaScript syntax

Interactive Demo


animation-fill-mode: <single-animation-fill-mode> [ ',' <single-animation-fill-mode> ]* 


<single-animation-fill-mode> = none | forwards | backwards | both
  • noneThe animation will not apply any styles to the target before or after it is executing.
  • forwardsThe target will retain the computed values set by the last keyframe encountered during execution.
  • backwardsThe animation will apply the values defined in the first relevant keyframe as soon as it is applied to the target, and retain this during the animation-delay period.
  • bothThe animation will follow the rules for both forwards and backwards, thus extending the animation properties in both directions.


<p>Move your mouse over the gray box!</p>
<div class="demo">
<div class="growsandstays">This grows and stays big.</div>
<div class="grows">This just grows.</div>
.demo {
  border-top: 100px solid #ccc;
  height: 300px;

@keyframes grow {
  0% { font-size: 0; }
  100% { font-size: 40px; }

.demo:hover .grows {
  animation-name: grow;
  animation-duration: 3s;

.demo:hover .growsandstays {
  animation-name: grow;
  animation-duration: 3s;
  animation-fill-mode: forwards;

Browser Support

The following table will show you the current browser support for the CSS animation-fill-mode property.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 31st December 2023