Result Size: 625 x 534
x
 
<!DOCTYPE html>
<html>
<head>
<style>
img.a {
  width: 200px;
  height: 400px;
  object-fit: none;
  object-position: 5px 10%;
  border: 5px solid red;
}
</style>
</head>
<body>
<h2>object-position 属性</h2>
<p>调整图像大小以适合其内容框,并将图像定位在内容框内距左侧 5px 和距顶部 10% 的位置:</p>
<img class="a" src="paris.jpg" alt="巴黎" width="400" height="300">
<h2>原始图像:</h2>
<img src="paris.jpg" alt="巴黎" width="400" height="300">
<p>注意:Internet Explorer/Edge 15 或更早版本不支持 object-position 和 object-fit 属性。</p>
</body>
</html>