I have a parent div that is set to be 480px tall. It has two children both of which have there content dynamically filled with AJAX, so I don't know how tall they will end up being. The top child acts as a header and I need all the information to display but the second child will just have a long list that will have overflow: auto;. Is there a way make the second child just fill in the rest of the space that the first child didn't use?
<div id = "parent">
<div id = "child1" >
<h2>Header</h2>
<p>Paragraph. I don't know ho long it will be.</p>
</div>
<div id = "child2" >
<ul>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>etc...</li>
</ul>
</div>
</div>
#parent {
background-color: cornflowerblue;
max-width: 700px;
height: 480px;
margin: 0 auto;
text-align: center;
padding: 5px;
}
#child2 {
height: 150px;
overflow: auto;
}
#child2 ul {
list-style: none;
margin: 0;
padding 0;
}
Looking around I found a couple solutions that were kind of close to what I need but not quite right. For example this question had a good solution but required the first child to be a fixed height. This one is even closer but still no good, for the same reason. Is there even a way to work around this?