I have a div and I have set its width to 100%
So the div can resize as its parent element or window resizes.
However, I want the div to have a 50% height, what CSS should I write? (or any other percentage, not just 50%)
It seems that 50%
is definitely the wrong way to go.
I can use JavaScript to do this but is there any pure CSS way?
#out {
border:1px solid #f00;
position:relative;
width:100%;
height:50%;
}
<div id="out">
stuff<br>
stuff<br>
</div>