1 回答
TA贡献1810条经验 获得超4个赞
.box{
position: relative;
padding-top: 25%;
overflow: hidden;
width: 25%;
float: left;
}
.box img{
position: absolute;
top: 0;
width: 100%;
height: 100%;
}
<div class="box">
<img src="img/2e0f7f7.png"/>
</div>
<div class="box">
<img src="img/2e0f7f7.png"/>
</div>
<div class="box">
<img src="img/2e0f7f7.png"/>
</div>
<div class="box">
<img src="img/2e0f7f7.png"/>
</div>
用vw的话
.box{
font-size:0;
}
img{
width: 25vw;
height: 25vw;
vertical-align: top;
}
<div class="box">
<img src="img/2e0f7f7.png"/>
<img src="img/2e0f7f7.png"/>
<img src="img/2e0f7f7.png"/>
<img src="img/2e0f7f7.png"/>
</div>
添加回答
举报