I want the blue div to not overflow the red div but always fill parent. I check on stackoverflow and they advised using height:100% but since the child have padding, it overflows. How to do that without changing the style of class parent ?
.parent {
background: red;
height: 150px;
width:300px;
}
.child{
height: 100%;
padding:20px;
width:100px;
background: blue;
}
<div class='parent'>
<div class='child'>
</div>
</div>