The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › expand div’s height to fit its container
Hi: I have a container div with two inner divs, one below the other(not floated), and the first inner div with a fixed height. The question is: how can I make the second div to expand its height to fit its parent?
I am not understanding what you are trying to accomplish. can you show us your code?
Its parent is only as tall as the two child divs, unless you’ve set a height.
Got it completely, so here you go http://codepen.io/anon/pen/qBneu
Keep in mind it isn’t fool proof and has some pitfalls
@Schwarttzy – .container needs to be height: 400px; not min-height: 400px;. Do that, and it works.
height: 400px;
min-height: 400px;