CSS propertyAnimations

animation-play-state

Pauses or resumes an animation.

Initial value
running
Inherited
No
Animatable
no
Applies to
all elements and the ::before and ::after pseudo-elements
JavaScript
element.style.animationPlayState = "paused"
On this page

Example

#
CSS
.marquee {
  animation: scroll 12s linear infinite;
}

.marquee:hover {
  animation-play-state: paused;
}
Preview

Definition and usage

#

The animation-play-state property takes two values: running (the animation plays) and paused (the animation stands still). After resuming, the animation continues from the point where it was stopped, not from the beginning.

A popular pattern is pausing the animation on hover, for example a scrolling strip of logos, so the content can be read.

You can also toggle the state in JavaScript, for example by pausing animations when the element is not visible on screen.

Syntax

#
Syntax
animation-play-state: running | paused [, …]*;

Values

#
  • running

    The gear rotates.
  • paused

    The gear stands still where it stopped.

Values in practice

#

running

The gear rotates.
.demo { animation-play-state: running; }

paused

The gear stands still where it stopped.
.demo { animation-play-state: paused; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Pause a strip of scrolling items on hover and on keyboard focus.
  • Pausing animations that are off screen saves battery on phones.

Related entries

#

Practise it in lessons

#

Spotted a mistake or missing an example? Write to us.