Home  >  Article  >  Web Front-end  >  How to use the animation-delay attribute

How to use the animation-delay attribute

青灯夜游
青灯夜游Original
2019-01-31 11:14:094335browse

The animation-delay attribute is used to define when the animation starts, in seconds or milliseconds; use the animation-delay attribute to customize the delay effect of the animation.

How to use the animation-delay attribute

CSS3 animation-delay property

Function: animation The -delay attribute defines when the animation starts. animation-delay value is in seconds or milliseconds.

Syntax:

animation-delay: time;

time: can be omitted, the default value is 0; used to define the waiting time before the animation starts, in seconds or milliseconds.

Note: time is allowed to be a negative value, -2s causes the animation to start immediately, but skips 2 seconds to enter the animation.

Note: Internet Explorer 9 and earlier versions do not support the animation-delay attribute.

CSS3 animation-delay property usage example

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 5s infinite;
animation-delay:2s;

/*Safari and Chrome*/
-webkit-animation:mymove 5s infinite;
-webkit-animation-delay:2s;
}

@keyframes mymove
{
from {left:0px;}
to {left:200px;}
}

@-webkit-keyframes mymove /*Safari and Chrome*/
{
from {left:0px;}
to {left:200px;}
}
</style>
</head>
<body>

<div></div>

</body>
</html>

Rendering:

How to use the animation-delay attribute

The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of How to use the animation-delay attribute. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn