Make a Div fill remainder of a container Div

Hello again, I’ve got a small issue that I hope someone can solve. I have 3 divs inside of a container div with a fixed height. Without knowing the heights of DIV1 & DIV3 (both variable depending on content) I want DIV2 to expand in the middle to fill any remaining space. Any help appreciated. I’ve had a search and can’t find a similar solution.

<div class="CONTAINER" height="400px">
<div class="DIV1">Header Text</div>
<div class="DIV2">Content Text</div>
<div class="DIV3">Footer Text</div>

Thanks in advance.

Sorry for wasting time, worked it out. Was pretty obvious but something else in my style was messing it up.

	position: relative;
	position: absolute;
	bottom: 0;

It doesn’t expand div2 but puts white space between div2 & div3 which in effect is the same.


Problem not actually solved, if div2 has too much content it flows over div3, instead of applying for example a scrollbar (overflow: scroll;) any suggestions?