The animation-fill-mode
property
sets styles to apply for the elements when the animation is not playing.
animation-fill-mode: none|forwards|backwards|both|initial|inherit;
animation-fill-mode |
Yes | 10.0 | Yes | Yes | Yes |
<!DOCTYPE html>
<html>
<head>
<style>
div {<!--from w ww . j a v a2 s . c o m-->
width: 100px;
height: 100px;
background: black;
position: relative;
-webkit-animation: mymove 3s; /* Chrome, Safari, Opera */
-webkit-animation-iteration-count: 2; /* Chrome, Safari, Opera */
-webkit-animation-fill-mode: both; /* Chrome, Safari, Opera */
animation: mymove 3s;
animation-iteration-count: 2;
animation-fill-mode: forwards;
}
@-webkit-keyframes mymove {
from {top: 0px;}
to {top: 200px;}
}
@keyframes mymove {
from {top: 0px;}
to {top: 200px;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>