【发布时间】:2015-07-06 08:10:08
【问题描述】:
好的,我正在尝试设计一个网站,其顶部的图像跨越浏览器的整个宽度。在此之下,我想放置不同颜色的 div 容器,它们也跨越整个宽度。有点像这样: http://hayden-demo.squarespace.com/
我尝试过 background-size:cover 但我希望页面的每个部分都有不同的背景。经过数小时的搜索,我唯一发现的是 width: 100% 但它在我的图像周围留下了白色边框...... 请帮忙,我很绝望。这是我当前的 CSS:
.mainimg {
background-image: url(_DSC0656.jpg);
background-repeat: no-repeat;
background-position: center center;
-moz-background-size: cover;
background-size: cover;
width:100% !important;
height: 700px;
margin:0 auto;
display:block;
}
【问题讨论】: