Make <body> fill entire screen?

前端 未结 10 1053
春和景丽
春和景丽 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:59

    As none of the other answers worked for me, I decided to post this as an answer for others looking for a solution who also found the same problem. Both the html and body needed to be set with min-height or the gradient would not fill the body height.

    I found Stephen P's comment to provide the correct answer to this.

    html {
        /* To make use of full height of page*/
        min-height: 100%;
        margin: 0;
    }
    body {
        min-height: 100%;
        margin: 0;
    }
    

    background filling body height

    When I have the html (or the html and body) height set to 100%,

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

    background not filling body

提交回复
热议问题