我正在尝试设置一系列具有背景图像的div,每个div都有自己固定的高度,并且可以拉伸以填满宽度,即使顶部/底部溢出被剪切。我只是不想在边缘留下空白。
目前,我有:http://jsfiddle.net/ndKWN/
CSS
#main-container {
float: left;
width: 100%;
margin: 0;
padding: 0;
text-align: center;
}
.chapter {
position: relative;
height: 1400px;
z-index: 1;
}
#chapter1 {
background: url(http://omset.files.wordpress.com/2010/06/homer-simpson-1-264a0.jpg) 50% 0 no-repeat fixed;
height: 1200px;
}
#chapter2 {
background: url(http://download.ultradownloads.com.br/wallpaper/94781_Papel-de-Parede-Homer-Simpson--94781_1680x1050.jpg) 50% 0 no-repeat fixed;
height: 1200px;
}
body { padding: 0px; margin: 0px; }
。 - Stefan Brendle