CSS3 animation-fill-mode 属性

把物体动画地从一个地方移动到另一个地方,并让它停留在那里:

animation-fill-mode:forwards;
-webkit-animation-fill-mode:forwards; /* Safari 和 Chrome */
 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
<style> 
div
{
    width:100px;
    height:100px;
    background:red;
    position:relative;
    animation:mymove 3s;
    animation-iteration-count:2;
    animation-fill-mode:forwards;

    /* Safari 和 Chrome */
    -webkit-animation:mymove 3s;
    -webkit-animation-iteration-count:2;
    -webkit-animation-fill-mode:forwards;
}

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

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

<p><strong>注意:</strong>Internet Explorer 9 及其之前的版本不支持 animation-fill-mode 属性。</p>

<div></div>

</body>
</html>
View Code

https://www.runoob.com/try/try.php?filename=trycss3_animation-fill-mode

posted on 2019-11-11 15:27  Mc525  阅读(184)  评论(0)    收藏  举报

导航