我的背景体是图像,容器也是图像,但容器图像是响应的而背景不是。我试过各种方法,但仍然没有运气。请帮忙,这是我的代码:
body{
background: url(http://i.imgur.com/T05z1d7.jpg); (This image should be responsive)
width: 100%;
height: auto;
}
.container{
width:960px;
margin:0 auto;
}
.paper{
width: 100%;
display: block;
margin: 0 auto;
position: relative;
top: 0;
left: 0;
}
<div class="container"> (This image is already responsive)
<img src="http://i.imgur.com/94fCwZx.jpg" class="paper">
</div>
答案 0 :(得分:0)
尝试替换
body{
background: url(http://i.imgur.com/T05z1d7.jpg);
width: 100%;
height: auto;
}
用这个
body{
background: url(http://i.imgur.com/T05z1d7.jpg);
background-size: 100%;
}