现在有一张图片500x700的图片,需要放到在一个div里, div的宽高没有图片的宽高这么大,要做到自适应,在电脑屏幕缩小时,图片也跟着缩小,做到适应,但是一下子卡住了,求大神们指点...
<div class="box">
<div class="son">
<div class="son_img"></div>
</div>
</div>
.box{
width: 100%;
height: 100%;
background: #e1e1e1;
position: relative;
}
.son{
height: 60%;
width: 25%;
border: 1px solid #000;
top: 50%;
left: 160px;
transform: translateY(-50%);
position: absolute;
}
.son_img{
width: 100%;
height: 100%;
background-image: url('../images/1.png');
background-size: cover;
background-position: center;
}
另外建议这些比较大的图片最好用image标签