+ 4

body {width: 100%; height: 100%;}

Why do people use the CSS code in cases when it does nothing but not very nice horizontal scrolling? Is it some tradition?

19th Jan 2020, 9:58 AM
SergeiRom
3 Answers
+ 4
Ginfio I thought that children elements may expand parent elements and resizing children is a better way than resizing parents. Of course to have a child fully expanded a parent the parent should have no padding.
19th Jan 2020, 10:55 AM
SergeiRom
+ 4
Ginfio also I heard that height: 100% works not very well.
19th Jan 2020, 10:56 AM
SergeiRom
+ 2
I think it’s to allow the children elements to be able to have 100% width / height. <body> <div> </div> </body> I think it’s like... in this code example above: the div can’t have 100% height if the body doesn’t.
19th Jan 2020, 10:25 AM
Ginfio
Ginfio - avatar