A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3resource.com/html-css-exercise/css-properties/animation-name-answer.php below:

Website Navigation


CSS Properties: How to Specify the name of the keyframe you want to bind to the selector?

CSS Properties: How to Specify the name of the keyframe you want to bind to the selector?Last update on February 15 2024 10:04:23 (UTC/GMT +8 hours)

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html>
<html>
<head>
<title>How to Specify the name of the keyframe you want to bind to the selector</title><!-- Set the title of the HTML document -->
</head>
<body>
<p>w3resource</p>
<div></div><!-- Create a div element -->
<p>Tutorial</p>
<style type="text/css"> /* 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-name: move;  /* Chrome, Safari, Opera */ /* Specify the name of the keyframe animation for WebKit browsers */
-webkit-animation-duration: 8s;  /* Chrome, Safari, Opera */ /* Specify the duration of the animation for WebKit browsers */
animation-name: move; /* Specify the name of the keyframe animation */
animation-duration: 8s; /* Specify the duration of the animation */
}

/* 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>
</body>
</html>

Explanation:

Live Demo:

See the Pen animation-name-answer by w3resource (@w3resource) on CodePen.

See the solution in the browser

Supported browser

Go to Exercise page

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