I am seeking a solution for creating a layout with three vertically stacked divs.
The top div must have a fixed height of 60px.
The middle div might contain content exceeding its height, therefore we've set it to overflow: auto
. But regardless of the content, it should take up the remaining height of the window minus the height of the top and bottom divs.
The bottom div must have a minimum height of 40px and can expand both upward and downward depending on user input, ranging from 40px to 400px. Once it reaches its maximum height, it should start scrolling.
Visualizing the structure:
+-----------+
| Header |
+-----------+
| ^|
| ||
| Scroll ||
| ||
| v|
+-----------+
| ^|
| Footer ||
| v|
+-----------+
I am encountering an issue where the middle div doesn't shrink as the bottom div expands. I am looking for a solution that does not involve JavaScript, if feasible.