代码示例:(标识:cssref_anim_object-position)
<!DOCTYPE html>
<html>
<head>
<style> 
#myImg {
  width: 200px;
  height: 400px;
  object-fit: cover;
  object-position: 0% 0%;
  animation: mymove 5s infinite;
}  

@keyframes mymove {
  0% {
    object-position: 0% 0%;
  }
  25% {
    object-position: 20% 0%;
  }
  100% {
    object-position: 100% 100%;
  }
}
</style>
</head>
<body>

<h1>object-position 的动画效果:</h1>

<p>逐渐更改图像在其内容框中的位置:<p>

<img src="/static/demo/images/tulip.jpg" alt="Tulip" id="myImg" width="400" height="300">

<p class="note"><span>注释:</span>Internet Explorer/Edge 15 或更早的版本不支持 object-position 和 object-fit 属性。</p>

</body>
</html>
运行结果: