HTML Code:
<!DOCTYPE html>
<html>
<head>
<title>How to animation-play-state property specify whether the animation is running or paused</title><!-- Set the title of the HTML document -->
<style> /* CSS style start*/
div {
width: 80px; /* Set the width of the div */
height: 120px; /* Set the height of the div */
background: #CC00CC; /* Set the background color of the div */
position: relative; /* Set the position of the div to relative */
-webkit-animation: move 8s; /* Chrome, Safari, Opera */ /* Apply animation named "move" with a duration of 8 seconds for WebKit browsers */
-webkit-animation-play-state: running; /* Chrome, Safari, Opera */ /* Specify that the animation is running initially for WebKit browsers */
animation: move 8s; /* Apply animation named "move" with a duration of 8 seconds */
animation-play-state: running; /* Specify that the animation is running initially */
}
/* Chrome, Safari, Opera */
@-webkit-keyframes move {
from {left: 0px;} /* Define initial position */
to {left: 200px;} /* Define final position */
}
@keyframes move {
from {left: 0px;} /* Define initial position */
to {left: 200px;} /* Define final position */
}
</style>
</head>
<body>
<p>w3resource</p>
<div></div><!-- Create a div element -->
<p>Tutorial</p>
</body>
</html>
Explanation:
Live Demo:
See the Pen animation-play-state-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4