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>
https://www.runoob.com/try/try.php?filename=trycss3_animation-fill-mode
浙公网安备 33010602011771号