为了让背景图片铺满整个页面,我们可以这样设置:

第一、页面只有屏幕大小:

    background: url(../images/banner.jpg) no-repeat;
    background-size: 100% 100% ;

如果页面大于屏幕时,如果滑动就会出现白板

第二、页面随内容大小变化而变化的,页面滑动也会铺满页面大小

    background: url(../images/banner.jpg) no-repeat;
    background-size: 100% 100% ;
    background-attachment: fixed;

更多推荐

html 怎么让背景图铺满整个页面