W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <head> <style> div { width: 100px; height: 100px; background: red; position: relative; animation-name: example; animation-duration: 3s; animation-delay: 2s; animation-fill-mode: backwards; } @keyframes example { from {top: 0px; background-color: yellow;} to {top: 200px;} } </style> </head> <body> <p>动画开始之前(animation-delay 期间),让 div 元素获取第一个关键帧设置的样式值:</p> <div></div> <p><b>注释:</b>Internet Explorer 9 以及更早的版本不支持 animation-fill-mode 属性。</p> </body> </html>