<div class="item>
<img src="beyond.jpg>
</div>
css
.item{
width:100%;
height:100%;
padding-bottom: 100%; /* 这个值可以调成自己想要的比值, 比如4:3的话就设置75% */
position: relative;
}
.item img{
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
position: absolute;
}
}