Applying a background to <html> and/or <body>

前端 未结 2 2009
梦毁少年i
梦毁少年i 2020-11-22 06:16

http://jsfiddle.net/julien_c/GmAL4/

I found that if you apply a CSS background to body, it takes up the whole page (no matter what the actual height or

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 06:44

    Suggest reading this:

    https://css-tricks.com/just-one-of-those-weird-things-about-css-background-on-body/

    Essentially, in the absence of a background on the html element, the body background will cover the page. If there is a background on the html element, the body background behaves just like any other element.

提交回复
热议问题