css animation-play-state property specifies whether the animation is running or paused. animation-play-state: paused; means the animation has been paused, animation-play-state: running; means the animation is playing.
#How to use the css animation-play-state property?
Function: The animation-play-state attribute specifies whether the animation is running or paused.
Syntax:
animation-play-state: paused|running;
Description: paused Specifies that the animation has been paused. running specifies that the animation is playing.
Note: You can use this attribute in JavaScript to pause the animation during playback.
css animation-play-state property usage example
<!DOCTYPE html> <html> <head> <style> div { width:100px; height:100px; background:red; position:relative; animation:mymove 5s; animation-play-state:paused; /* Safari and Chrome */ -webkit-animation:mymove 5s; -webkit-animation-play-state:paused; } @keyframes mymove { from {left:0px;} to {left:200px;} } @-webkit-keyframes mymove /* Safari and Chrome */ { from {left:0px;} to {left:200px;} } </style> </head> <body> <p><strong>注释:</strong>Internet Explorer 9 以及更早的版本不支持 animation-play-state 属性。</p> <div></div> </body> </html>
Effect:
The above is the detailed content of How to use css animation-play-state property. For more information, please follow other related articles on the PHP Chinese website!