CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES

CSS3 animation-play-state Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The animation-play-state property specifies whether an animation is playing or paused.

The following table summarizes the usages context and the version history of this property.

Default value: running
Applies to: All elements, ::before and ::after pseudo-elements
Inherited: No
Animatable: No. See animatable properties.
Version: New in CSS3

Syntax

The syntax of the property is given with:

animation-play-state: 
paused | running | initial | inherit

The example below shows the animation-play-state property in action.

.box {
    width: 50px;
    height: 50px;
    background: red;
    position: relative;
    /* Chrome, Safari, Opera */
    -webkit-animation-name: moveit;
    -webkit-animation-duration: 2s;
    -webkit-animation-play-state: paused;
    /* Standard syntax */
    animation-name: moveit;
    animation-duration: 2s;
    animation-play-state: paused;
}
 
/* Chrome, Safari, Opera */
@-webkit-keyframes moveit {
    from {left: 0;}
    to {left: 50%;}
}
 
/* Standard syntax */
@keyframes moveit {
    from {left: 0;}
    to {left: 50%;}
}

Property Values

The following table describes the values of this property.

Value Description
paused Specifies that the animation is currently paused.
running Specifies that the animation is currently running. This is default value.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-play-state property.

Note: You can use the animation-play-state CSS property in combination with the JavaScript to pause an animation in the middle of a cycle.


Browser Compatibility

The animation-play-state property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 5+ -moz-, 15+
  • Google Chrome 4+ -webkit-
  • Internet Explorer 10+
  • Apple Safari 4+ -webkit-
  • Opera 12+ -o-, 15+ -webkit-

Further Reading

See tutorial on: CSS3 Animations.

Related properties and at-rules: animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, animation-fill-mode, animation-play-state, @keyframes.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties