Is there a way to prevent the blue div from overflowing the red div, but still always fill its parent container? I searched on stackoverflow and found suggestions to use height: 100%, but this causes issues when the child element has padding. How can this be achieved without altering the styling of the parent class?
.parent {
background: red;
height: 150px;
width:300px;
}
.child{
height: 100%;
padding:20px;
width:100px;
background: blue;
}
<div class='parent'>
<div class='child'>
</div>
</div>