Make <body> fill entire screen?

前端 未结 10 1038
春和景丽
春和景丽 2020-11-27 11:37

I\'m using a radial gradient as the background on my webpage, like so:

background-image: -webkit-gradient(radial, 100         


        
10条回答
  •  臣服心动
    2020-11-27 11:43

    On our site we have pages where the content is static, and pages where it is loaded in with AJAX. On one page (a search page), there were cases when the AJAX results would more than fill the page, and cases where it would return no results. In order for the background image to fill the page in all cases we had to apply the following CSS:

    html {
       margin: 0px;
       height: 100%;
       width: 100%;
    }
    
    body {
       margin: 0px;
       min-height: 100%;
       width: 100%;
    }
    

    height for the html and min-height for the body.

提交回复
热议问题