更新时间:2022-12-25 18:56:00
您可以使用两种方法的组合,例如
You could use a combination of both methods eg.
<div class="crop">
<img src="..." alt="..." />
</div>
CSS:
.crop {
width: 200px;
height: 150px;
overflow: hidden;
}
.crop img {
width: 400px;
height: 300px;
margin: -75px 0 0 -100px;
}
您可以使用负值保证金
在< div />
中移动图片。
You can use negative margin
to move the image around within the <div/>
.