Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS animation-fill-mode property

CSS3 animation-fill-mode property

CSS Reference Manual CSS Reference Manual

Example

Animate an object from one place to another and make it stay there:

animation-fill-mode

:forwards

; -

webkit-animation-fill-mode

:forwards

;

/*

Safari and Chrome

*/

Try it »


Browser support

The numbers in the table indicate the first browser version that supports this property.

A number immediately before -webkit-, -ms-, or -moz- indicates the first browser version that supports that prefixed property.

property
animation-fill-mode 4.0 -webkit- 10.0 16.0
5.0 -moz- 4.0 -webkit- 15.0 -webkit-
 12.1       

 12.0 -o- |


Definition and Usage

The animation-fill-mode property specifies the styles to apply to the element when the animation is not playing (when it has finished, or when it has a delay and has not started).

By default, CSS animations do not affect an element before the first keyframe is played or after the last keyframe is complete. The animation-fill-mode property can override this behavior.

Default value: none
Inherited: No
Animatable: No. See Animatable.
Version: CSS3
JavaScript syntax: object.style.animationFillMode="forwards" Try it

CSS Syntax

animation-fill-mode: none|forwards|backwards|both|initial|inherit;

Attribute values

Value Description
none Default. The animation does not apply any styles to the target element before or after it is executed.
forwards After the animation ends (as determined by animation-iteration-count), the animation will apply this property value.
backwards The animation will apply the property values defined in the keyframe when the first iteration of the animation starts, during the period defined by animation-delay. These are the values in the from keyframe (when animation-direction is "normal" or "alternate") or the values in the to keyframe (when animation-direction is "reverse" or "alternate-reverse").
both The animation follows the rules for both forwards and backwards. That is, the animation extends the animated properties in both directions.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Related Articles

CSS3 Tutorial:CSS3 Animations

CSS Reference Manual CSS Reference Manual