I am trying to create a responsive div, which has a section and aside. The parent div occupies 25% height. And the child divs has to occupy 80% of the their parent container. But they are not occupying if the height is in %. But it works fine when the height is given in pixels. Can any one tell me where I went wrong. Here is the html
<div class="container">
<section>
This is supposed to be a section
</section>
<aside>
This is supposed to be aside
</aside>
</div>
Here is the CSS
.container{
width: 100%;
background: red;
height: 25%;
}
.container::before,
.container::after{
content: "";
display: table;
}
.container::after{
clear: both;
}
section{
float: left;
width: 40%;
height: 100%;
display: block;
}
aside{
float: right;
width: 40%;
height: 80%;
}
section, aside{
background: green;
border-radius: 6px;
margin: 5%;
}
Here is my fiddle https://jsfiddle.net/gvpmahesh/Lhpv0k2x/3/