I am trying to create a layout that looks something like this:

If the header and footer are attached to the window and the blue area scrolls vertically if space is required.
I thought I would display:flexdo this and the code below will come closer, but there is a problem. If you scroll this content area, it will look like this:

It seems that the divs for "left nav" and "content" are broken to the height of their parent, although this parent is scrollable.
var linesToAdd = 100;
var html = "";
for (var i=0; i<linesToAdd; i++) {
html += i + "<br/>"
}
document.getElementById('content').innerHTML = html;
html {
height: 100%;
}
body {
margin: 0;
display: flex;
flex-direction: column;
height:100%
}
#header, #footer {
background: #ffa0a0;
flex-shrink:0;
}
#mid {
flex-grow: 1;
background: #a08080;
overflow-y: scroll;
display: flex;
}
#leftnav {
padding: 10px;
background: #8a8;
}
#content {
background: #88a;
padding: 10px;
}
<!doctype html>
<html>
<body>
<div id="header">Header</div>
<div id='mid'>
<div id='leftnav'>Left nav</div>
<div id='content'></div>
</div>
<div id="footer">Footer</div>
</body>
</html>
Run codeHide result, , , , . -, , , .
var linesToAdd = 5;
var html = "";
for (var i=0; i<linesToAdd; i++) {
html += i + "<br/>"
}
document.getElementById('content').innerHTML = html;
html {
height: 100%;
}
body {
margin: 0;
display: flex;
flex-direction: column;
height:100%
}
#header, #footer {
background: #ffa0a0;
flex-shrink:0;
}
#mid {
flex-grow:1;
background:#a88;
overflow-y:scroll;
}
#leftnav {
padding: 10px;
background: #8a8;
}
#content {
background: #88a;
padding: 10px;
}
<!doctype html>
<html>
<body>
<div id="header">Header</div>
<div id='mid' style="">
<div style="display:flex">
<div id='leftnav'>Left nav</div>
<div id='content'></div>
</div>
</div>
<div id="footer">Footer</div>
</body>
</html>
Hide result