Why div height 100 not working?
Photo by Maik Jonietz on Unsplash
In order for a percentage value to work for height, the parent’s height must be determined. The only exception is the root element <html>
, which can be a percentage height. .
So, you’ve given all of your elements height, except for the <html>
, so what you should do is add this:
|
|
And your code should work fine.
|
|
JsFiddle example. By: Madara’s Ghost From html — Why doesn’t height: 100% work to expand divs to the screen height? — Stack Overflow
Contact me: Hung, Chien-Hsiang (chienhsiang-hung.github.io)