I don’t want to set body‘s height explicitely and set child divs’ height in percents.
<!doctype html>
<html>
<body>
<div style="height:10%">
fdjfdkjl
</div>
<div style="height:90%">
dsds
</div>
</body>
</html>
However, this doesn’t work. Why? In the specs there is description of behavior:
When the percent notation is used height of the element is calculated
relatively to height of the parent. If the parent is doesn’t set
explicitely the browser’s window is used.
Okay, I can set 100% to the body, but this is doesn’t work too: its height is just wrapping the content. Why browser’s window is not used?
As @MattK said,
solves the problem. I think this approach works because
divs’ andbody‘s parents have defined sizes.htmlhasn’t a parent and the window’sheightis used.