CSS3 animation-play-state Property

Example

Pause an animation:

div {
animation-play-state: paused;
}

Try it Yourself »

More “Try it Yourself” examples below.

Definition and Usage

The animation-play-state property specifies whether the animation is running or paused.

Note: Use this property in a JavaScript to pause an animation in the middle of a cycle.

Default value: running
Inherited: no
Animatable: no. Read about animatable
Version: CSS3
JavaScript syntax: object.style.animationPlayState=”paused” Try it

CSS Syntax
animation-play-state: paused|running|initial|inherit;
Property Values
Value Description Play it
paused Specifies that the animation is paused div#myDIV {
animation-play-state:paused;
}
running Default value. Specifies that the animation is running div#myDIV {
animation-play-state:running;
}
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit
Example

Pause an animation on hover:

div:hover {
animation-play-state: paused;
}

Try it Yourself »

Post Author: Zahid Farid