Why does html, body {height: 100%} cause the scrollbar to appear?

I am trying to create a website with a “div panel on the left” and a “content” div on the right, both are contained in the <body> , and I want them to dynamically expand the height to the size of the window. The problem is that when I use html,body{height:100%} , a scrollbar appears. I hesitate to publish the full code of what I am doing, but it is still doing it with truncated to:

  <!DOCTYPE HTML> <HTML> <HEAD> <STYLE> html, body {height:100%} </STYLE> <BODY> </BODY> </HTML> 

so I don’t think that something that I do can go bad ...

I will try to provide additional information upon request.

+4
source share
3 answers

HTML / BODY received standard addition / margin on

to try:

  <!DOCTYPE HTML> <HTML> <HEAD> <STYLE> html, body {height:100%; margin:0; padding:0;} </STYLE> </HEAD> <BODY> </BODY> </HTML> 
+10
source

<body> by default has 8 pixels of a field that goes beyond 100% .

You need to remove it.

+10
source

Add the following attributes to your object:

 margin: 0px; padding: 0px; 
+2
source

Source: https://habr.com/ru/post/1499216/


All Articles