CSS animation-play-state Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Animations & Keyframes

What You’ll Learn

The animation-play-state property lets you pause or resume a CSS animation without removing it. It is useful for hover effects, play buttons, and interactive UI controls.

01

Pause & Resume

Control playback state.

02

Syntax

running and paused.

03

Default running

Animations play normally.

04

Freeze Frame

Pause at current progress.

05

CSS Triggers

Use :hover or classes.

06

Multiple Animations

Pause one or many at once.

Definition and Usage

The animation-play-state CSS property controls whether an animation is running or paused. When paused, the animation stops at its current frame and keeps that visual state until playback resumes.

This property is especially helpful when you want user interaction to control motion. For example, you can pause a loader until the user hovers over it, or add a button that toggles animation playback with a CSS class.

💡
Beginner Tip

animation-play-state does not remove the animation. It only pauses or resumes playback, so the element keeps its animation settings.

📝 Syntax

Set animation-play-state to running or paused:

syntax.css
selector {
  animation-play-state: running | paused;
}

Basic Example

animation-play-state.css
@keyframes move {
  from { transform: translateX(0); }
  to { transform: translateX(200px); }
}

.box {
  animation: move 4s infinite;
  animation-play-state: paused;
}

.box:hover {
  animation-play-state: running;
}

Syntax Rules

  • The initial value is running, so animations play by default.
  • paused freezes the animation at its current frame.
  • Setting the value back to running resumes from the same point.
  • You can use pseudo-classes like :hover or :focus-within to change play state.
  • For multiple animations, list values in the same order as other animation properties.

⚡ Quick Reference

QuestionAnswer
Initial valuerunning
Applies toAll elements with a CSS animation
InheritedNo
AnimatableNo
Common usePausing loaders, hover-to-play effects, and user-controlled motion

Default Value

The initial value of animation-play-state is running. Animations play normally as soon as they start, unless you explicitly set the value to paused.

💎 Property Values

These are the main values used to control animation playback.

ValueExampleMeaning
runninganimation-play-state: running;The animation plays normally
pausedanimation-play-state: paused;The animation is frozen at the current frame
initialanimation-play-state: initial;Resets to the default value running
inheritanimation-play-state: inherit;Inherits the play state from the parent element
running

The box moves across the track because the animation is actively playing.

animation-play-state: running

This is the default playback state.

paused

The box stays frozen at its current position until playback resumes.

animation-play-state: paused

Useful for hover effects and manual controls.

Pause vs Stop

Beginners often confuse pausing an animation with removing it entirely. They behave differently:

ActionCSS approachWhat happens
Pauseanimation-play-state: paused;Animation stays attached and freezes at the current frame
Resumeanimation-play-state: running;Animation continues from the same progress point
Stop completelyanimation: none; or remove animation propertiesAnimation is removed and styling may reset

running vs paused

ValueWhat it doesCommon use case
runningAnimation progresses through keyframesLoaders, banners, and ambient motion
pausedAnimation stops at the current frameHover-to-play demos, paused previews, user toggles

👀 Live Preview

This box starts paused. Hover over the demo area to set animation-play-state: running:

The red box only moves while you hover because play state switches from paused to running.

Examples Gallery

Try animation-play-state with hover playback, button toggles, parent controls, and multiple animations.

📚 Playback Control

Start with simple running and paused states on animated elements.

Example 1 — Hover to Play Animation

Pause the animation by default, then resume it when the user hovers over the box.

animation-play-state-hover.html
<style>
  @keyframes move {
    from { transform: translateX(0); }
    to { transform: translateX(200px); }
  }
  .box {
    width: 100px;
    height: 100px;
    background-color: red;
    animation: move 4s infinite;
    animation-play-state: paused;
  }
  .box:hover {
    animation-play-state: running;
  }
</style>

<div class="box"></div>
Try It Yourself

How It Works

The box stays still until hover changes animation-play-state from paused to running.

Example 2 — Toggle Pause with a Button

Use a CSS class and JavaScript to switch between paused and running states.

animation-play-state-toggle.html
<style>
  .spinner {
    animation: spin 1s linear infinite;
    animation-play-state: running;
  }
  .spinner.is-paused {
    animation-play-state: paused;
  }
</style>

<button id="toggleBtn">Pause</button>
<div class="spinner" id="spinner"></div>
Try It Yourself

How It Works

Adding .is-paused sets animation-play-state: paused without removing the spinner animation.

Example 3 — Pause All Animations in a Container

Pause every animated child at once by setting play state on a parent wrapper.

animation-play-state-parent.css
.gallery {
  animation-play-state: running;
}

.gallery.is-paused {
  animation-play-state: paused;
}

.gallery.is-paused * {
  animation-play-state: inherit;
}
Try It Yourself

How It Works

Children inherit the parent’s paused state, so one class can freeze an entire animated section.

⚡ Multiple Animations

Control play state for more than one animation on the same element.

Example 4 — Pause One Animation, Keep Another Running

List play states in the same order as your animation names.

animation-play-state-multiple.css
.badge {
  animation-name: fadeIn, pulse;
  animation-duration: 0.6s, 1.5s;
  animation-iteration-count: 1, infinite;
  animation-play-state: running, paused;
}
Try It Yourself

How It Works

The first value controls fadeIn and the second controls pulse, matching the order in animation-name.

🧠 How animation-play-state Works

1

Animation starts running

By default, animation-play-state is running and keyframes progress normally.

Default
2

You set paused

The browser freezes the animation at the current frame without removing it.

Freeze
3

You set running again

Playback resumes from the same progress point, not from the beginning.

Resume
=

Interactive playback

Users can pause and resume motion with CSS or JavaScript controls.

Universal Browser Support

animation-play-state is supported in all modern browsers alongside CSS animations.

Baseline · CSS Animations

Pause and resume animations in modern browsers

Chrome, Firefox, Safari, Edge, and Opera all support running and paused play states.

98% Modern browser support
Google Chrome43+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera30+ · Modern versions
Full support

Legacy browsers

Very old browsers without CSS animation support also lack animation-play-state.

💻
Internet Explorer IE 9 and earlier · No CSS animation support
None
animation-play-state property 98% supported

Bottom line: Use play state for interactive pause and resume controls in modern browsers.

Conclusion

The animation-play-state property gives you simple playback control over CSS animations. Set it to paused to freeze motion, or running to resume from the same frame.

Combine it with :hover, focus states, or JavaScript classes to build interactive effects such as hover-to-play demos, pause buttons, and animated sections users can control.

💡 Best Practices

✅ Do

  • Use paused for hover-to-play or preview effects
  • Toggle a class with JavaScript for pause and resume buttons
  • Respect prefers-reduced-motion for accessibility
  • Keep animation properties attached when pausing
  • Match comma-separated play states to animation order

❌ Don’t

  • Confuse paused with removing the animation entirely
  • Expect paused animations to restart from zero when resumed
  • Rely on hover-only controls for essential functionality on touch devices
  • Forget to provide a keyboard-accessible pause control when needed
  • Mix up the order of values when using multiple animations

Key Takeaways

Knowledge Unlocked

Five things to remember about animation-play-state

Use these points when building interactive animations.

5
Core concepts
⏹️02

Default running

Animations play normally.

Default
🔒03

Freeze Frame

Pause keeps current progress.

Behavior
🖱04

User Control

Great for buttons and hover.

Pattern
📈05

Not a Stop

Pause differs from removing animation.

Concept

❓ Frequently Asked Questions

The animation-play-state property controls whether a CSS animation is running or paused. When paused, the animation freezes at its current frame until you set it back to running.
The initial value is running, which means the animation plays normally as soon as it starts.
paused keeps the animation attached and frozen at the current progress. Removing animation or setting animation-name to none stops the animation entirely and resets styling based on other properties.
Yes. Common patterns include :hover, :focus-within, or toggling a class with JavaScript. For example, .box:hover { animation-play-state: running; } can resume playback on hover.
Yes. You can list running and paused values separated by commas, and each value pairs with the corresponding animation in the same order.

Practice in the Live Editor

Open the HTML editor and experiment with running and paused play states.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful