How to use 100% CSS background-image with scrolling content?

前端 未结 3 1920
感情败类
感情败类 2021-01-04 09:53

I want to create a site with a background image that always fills the entire window, even if the content can scroll vertically.

I have created this JSFiddle using ba

3条回答
  •  执念已碎
    2021-01-04 10:30

        #appcontainer {
            position: absolute;
            background-color: rgba(255, 255, 255, 0.7);
            background: url(images/bg.jpg) no-repeat center center fixed; 
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
            top: 0;
            right 0;
            left: 0;
            bottom 0;
        }
    

提交回复
热议问题