About height in css

Hi everyone Sometime when I post some codepen and when I wrote his
height:100vh;
height:100vh;
some people use to laugh and say is not usefull so now I have a question look this codepen https://codepen.io/alpha_66/pen/KKEVeQK?editors=1100 in the body I put
height:100vh;
height:100vh;
my div is on the center on the page so now Try to comment in the body height . question why my blue div is not is the center on the page ???? Kevin Powell make a video about it he say is a mistakes some begenners use to make thanks by advance
5 Replies
Mannix
Mannix5mo ago
why it's not in the center if you comment out the height? Because the body height = height of the elements that are inside of it
Zoë
Zoë5mo ago
If you want the body to be the whole height you want to use min-height instead so if content were to be bigger than the screen height it will na able to scroll
Pat66
Pat665mo ago
means to put
height
height
in the body is usefull !!!!
Mannix
Mannix5mo ago
it all depends on your project sometimes you need it sometimes you don't and as @z- ::theProblemSolver:: said use min-height instead if you need to
clevermissfox
clevermissfox5mo ago
it should be a min-height if you set anything, your content + padding should make up the size. putting heights creates problems, and fixed heights create migraines. were you to add more content to this page, enough that you had to scroll down to see the rest and had a fixed-height of 100vh on your body, all your content would overflow