I would like to create a div inside other div and make the div on the inside a % of the size of the outer side div.
I would like to have something maybe like this:
<div style="height:100px">
<div style="height:50%"></div>
</div>
And the result would be a div with 100px in height with another div on the inside with 50px in height.
Thanks to all in advance!!
CodePudding user response:
I mean it works, just change "=" into ":"
<div style="height:100px;background:blue;">
<div style="height:50%;background:red;"></div>
</div>
CodePudding user response:
You were close:
<div style="height:100px">
<div style="height:50%"></div>
</div>
You may need to add other formatting attributes to get exactly what you need (alignment, padding, margin etc.)