1.html
<div id="bo">
<img src="imgs/1.jpg">
</div>
css
#bo{
display:inline-block;
width:100%;/*图片自适应的父容器的宽*/
height:100%;/*图片自适应的父容器的高*/
}
#bo img{
width:100%;
height:100%;
}
2.
background-size的cover
1.html
<div id="bo">
<img src="imgs/1.jpg">
</div>
css
#bo{
display:inline-block;
width:100%;/*图片自适应的父容器的宽*/
height:100%;/*图片自适应的父容器的高*/
}
#bo img{
width:100%;
height:100%;
}
2.
background-size的cover