我一直在努力实现整页背景图片。我怎样才能让这个背景图片占据页面的高度而无需滚动?
#cover {
background: url(http://bootstrapguru.com/preview/cascade/images/carousel/imageOne.jpg) no-repeat center center fixed;
background-size: cover;
height:100%;
}
目前 100% 加上固定高度使它太高了。
最佳答案
给你的#cover
一个固定的位置和流动的尺寸:
#cover {
background: url(http://bootstrapguru.com/preview/cascade/images/carousel/imageOne.jpg) no-repeat center center fixed;
background-size: cover;
height:100%;
width: 100%;
position:fixed;
}
关于html - 整页背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23009505/