CSS Property animation-duration








The animation-duration property controls the time span in seconds or milliseconds for one animation cycle.

Summary

Initial value
0
Inherited
no
CSS Version
CSS3
JavaScript syntax
object.style.animationDuration="3s"
Animatable
no

CSS Syntax

animation-duration: time;

Property Values

time
set the time span in seconds or milliseconds for one animation cycle. Default value is 0, meaning there will be no animation

Browser compatibility

animation-duration 4.0 -webkit- 10.0 16.0 (5.0 -moz-) 4.0 -webkit- 15.0 -webkit- (12.0 -o-)




Example

<!DOCTYPE html>
<html>
<head>
<style> 
div {<!--from ww  w. j a va2 s .  c om-->
    width: 100px;
    height: 100px;
    background: black;
    position: relative;
    -webkit-animation: mymove infinite; /* Chrome, Safari, Opera */
    -webkit-animation-duration: 4s; /* Chrome, Safari, Opera */
    animation: mymove infinite;
    animation-duration: 4s;
}

/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
    from {top: 0px;}
    to {top: 200px;}
}

@keyframes mymove {
    from {top: 0px;}
    to {top: 200px;}
}
</style>
</head>
<body>

<div></div>

</body>
</html>

Click to view the demo