运行结果尺寸: 300 x 150
x
 
<!DOCTYPE html>
<html>
<head>
<style> 
div {
  width: 100px;
  height: 100px;
  background: red;
  position: relative;
  animation-name: example;
  animation-duration: 3s;  
  animation-fill-mode: forwards;
}
@keyframes example {
  from {top: 0px;}
  to {top: 200px; background-color: blue;}
}
</style>
</head>
<body>
<p>让 div 元素在动画结束时保留最后一个关键帧的样式值:</p>
<div></div>
<p><strong>注意:</strong> animation-fill-mode 属性在 Internet Explorer 9 及更早版本中不受支持。</p>
</body>
</html>
×

报个问题: