Make <body> fill entire screen?

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

    I tried all the solutions above and I'm not discrediting any of them, but in my case, they didn't work.

    For me, the problem was caused because the

    tag had a margin-top of 5em and the
    had a margin-bottom of 5em. I removed them and instead put some padding (top and bottom, respectively). I'm not sure if replacing the margin was an ideal fix to the problem, but the point is that, if the first and last elements in your has some margins, you might want to look into it and remove them.

    My html and body tags had the following styles

    body {
      line-height: 1;
      min-height: 100%;
      position: relative; }
    
    html {
      min-height: 100%;
      background-color: #3c3c3c; }
    

提交回复
热议问题