I have a 3rd party, scrollable, with 100% height element (that i don't want to modify). I would like to fit it inside a parent div, so it will fill all the space remaining.
I was attempted to do so using Flex. (see code snippet). The problem I've encounter is that because of the content of the 3rd part element, the child div become taller than the parent. Is there a way to make flex shrink the child to fit the remaining size of the parent?
EDIT: If possible, I would like to avoid any hard-coded numbers and let flex dynamically fit the size so the tall_child will fit the remaining parent size.
.parent {
background-color : blue;
height : 50vh;
display : flex;
flex-direction: column;
}
.header {
background-color : red;
height : 50px;
width : 80%
}
.tall_child {
background-color : green;
width : 80%;
/*
I want the height of the this child to be determined automaticlly by flex to fit remaining space of parent
*/
}
.scrollable_3rd_party_element {
height : 100%;
overflow : scroll;
border-style: solid;
border-width: 5px;
}
<div class="parent">
<div class="header">header</div>
<div class="tall_child">
<div class="scrollable_3rd_party_element">
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
</div>
</div>
</div>