Background is turned off when html and body height are set to 100%

I have html and body set to 100% height, and a background image mounted on the body that turns off when scrolling down, as shown below.

enter image description here

However, YouTube has a height of 100% on html and body and background on the body, and it stretches to the entire height of the content. How can I achieve this?

+1
source share
3 answers

If the argument is only you set 100% height for the background (as one of your comments might seem), just change it to min-height: 100%and you shouldn't have a problem. You will have 100% height on short pages, but will increase as long as you need more pages.

+6
source

, . "Extended" . - , "" , .

- , , , .

100% - - ... 8-) 100% , .

+1

, . "" , repeat-y ( ), : , , .

In your case, it looks like your background is solid. Can I suggest just using a simple background color? This makes it easier to read and modify your CSS code, and also reduces the throughput of your server.

0
source

All Articles