容器裁切 + 图片缩放,注意只动 transform。
<div class="iz"><img src="data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22300%22 height=%22200%22%3E%3Cdefs%3E%3ClinearGradient id=%22g%22 x1=%220%22 y1=%220%22 x2=%221%22 y2=%221%22%3E%3Cstop offset=%220%22 stop-color=%22%232b57ff%22/%3E%3Cstop offset=%221%22 stop-color=%22%23ff8a5c%22/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width=%22300%22 height=%22200%22 fill=%22url(%23g)%22/%3E%3C/svg%3E" alt=""></div>.iz {
width: 200px; height: 120px;
border-radius: 10px; overflow: hidden;
}
.iz img {
width: 100%; height: 100%;
object-fit: cover; display: block;
transition: scale .4s cubic-bezier(.2,.9,.3,1);
}
.iz:hover img { scale: 1.08; }复制后可直接使用;如果要放进已有项目,注意把类名改成你项目里的命名,避免冲突。