I have an element that can be any size. I need to set the child element to fill the remaining space. I wrote a little demo of my problem. https://www.w3schools.com/code/tryit.asp?filename=GPOS93IXT6E7
.random-size{
height:200px;
width:100px;
padding:10px;
background-color:grey;
}
.container-fill{
background-color:red;
height:100%;
}
<div class="random-size">
<div class="container-fill">
hello world
</div>
</div>
This is correct for the output for now but if I add another child element https://www.w3schools.com/code/tryit.asp?filename=GPOSB2B28A0I
<div class="random-size">
<div>uh oh</div>
<div class="container-fill">
hello world
</div>
</div>
As you see there is out of bounds content. I can't use overflow:hidden due to content will be displayed at the bottom. I tried using grids/tables but I could not figure it out. I don't want to resort to using calc.