CSS | animation-play-state Property

The animation-play-state property is used to specify whether the animation is running or paused.

Syntax:

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

Property Value: The animation-play-state property are listed below:

  • paused: This property is used to specify that the animation is paused.
  • running: It is the default value. This property is used to specify that the animation is running.
  • initial: This property is used to set its default value.
  • inherit: It is used to inherit the animation property from its parent.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
    <head
        <style
            body {
                text-align:center;
                width:70%;
            }
            h1 {
                color:green;
            }
            .gfg {
                width: 50px;
                height: 50px;
                background: green;
                position: relative;
                -webkit-animation: mymove 10s;
                -webkit-animation-play-state: play;
                animation: mymove 5s;
                animation-play-state: play;
            }
            .geeks {
                width: 50px;
                height: 50px;
                background: green;
                position: relative;
                -webkit-animation: mymove 10s;
                -webkit-animation-play-state: paused;
                animation: mymove 5s;
                animation-play-state: paused;
            }
            @-webkit-keyframes mymove {
                from {
                    left: 0%;
                }
                to {
                    left: 80%;
                }
            }
                  
            @keyframes mymove {
                from {
                    left: 0%;
                }
                to {
                    left: 80%;
                }
            }
        </style
    </head
    <body
        <h1>GeeksforGeeks</h1
        <h2>animation-play-state property</h2
        <div class = "gfg"></div><br
        <div class = "geeks"></div
    </body
</html>                                                  

chevron_right


Output:

Supported Browser: The browser supported by animation-play-state property are listed below:

  • Google Chrome 43.0
  • Internet Explorer 10.0
  • Firefox 16.0
  • Safari 9.0
  • Opera 30.0


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.