I have a page with the following layout requirements:
- a header with a fixed height
- a footer with a fixed height
- 2 divs (one on the left, one on the right) in the centre of the page who's height fills the space between the header and the footer
- a table inside the left div
Visually this should look as follows:
And I have gotten this working in code here: https://jsfiddle.net/1kxtby5c/2/
body {
background-color: pink;
padding: 0;
margin: 0;
}
.wrap {
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
}
.top {
background-color: red;
height: 100px;
}
.middle {
background-color: lightblue;
flex: 1;
}
.bottom {
background-color: green;
height: 100px;
}
.inner-window {
background-color: peachpuff;
height: 100%;
width: 45%;
}
#left {
float: left;
}
#right {
float: right;
}
The problem is that the table (being populated with an AJAX request) will be very tall. When the table height exceeds the height of the left div, I want the table to overflow and scroll, like this:
However what is actually happening is that the div height is growing to accommodate the table, and so the header and footer are being pushed off the page. You can see this here: https://jsfiddle.net/n8o065y2/
I understand that this happens because I have told the middle div to grow, but I don't know how to tell it "grow to fill the space between the header and footer, then stop growing to accommodate the tables large height".
Thanks!