Make <body> fill entire screen?

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

    Try using viewport (vh, vm) units of measure at the body level

    html, body { margin: 0; padding: 0; } body { min-height: 100vh; }

    Use vh units for horizontal margins, paddings, and borders on the body and subtract them from the min-height value.

    I've had bizarre results using vh,vm units on elements within the body, especially when re-sizing.

提交回复
热议问题