I´m currently trying to create yome kind of layout with fixed header and footer and an dynamic content area, which should use the remaining vertical space. The content-wrapper has a content container which can contain a lot of data, so a scrollbar can appear.
But now to the problem: as you can see, the main wrapper which simulates the page height, should stop at 200px height, but is being stretched by the content container.
I don´t want to use a max-height at the content-wrapper and also can´t use flex-shrink on the content-wrapper because this would screw up the layout by moving the footer inside the content area and let them overlap.
So with this in mind, how can I create a layout with a dynamic content area, which is not spreading vertical to infinity but takes the remaining space of the page and is displaying the provided content inside the content wrapper?
div.main-wrapper {
height: 200px;
max-height: 200px;
min-height: 200px;
width: 100%;
min-width: 100%;
display: flex;
flex-direction: column;
background: grey;
}
div.content-wrapper {
flex: 1 0 auto;
}
div.content {
width: 100%;
height: 100%;
display: flex;
flex-flow: column;
}
div.header,
div.footer {
height: 50px;
max-height: 50px;
min-height: 50px;
background-color: green;
min-width: 100%;
width: 100%;
}
<div class="main-wrapper">
<div class="header">FIXED HEADER</div>
<div class="content-wrapper">
<div class="content">
DYNAMIC CONTENT
<br/>DYNAMIC CONTENT
<br/>DYNAMIC CONTENT
<br/>DYNAMIC CONTENT
<br/>DYNAMIC CONTENT
<br/>DYNAMIC CONTENT
<br/>DYNAMIC CONTENT
<br/>DYNAMIC CONTENT
</div>
</div>
<div class="footer">FIXED FOOTER</div>
</div>
EDIT:
I edited my snippet in order to get more close to my real problem, which I´m trying go simplyfy: As you can see inside the content wrapper, there is another component, let´s treat it as a black box since this layout should work with every div inside the content-wrapper, that takes up 100% height and width. There should not just be added an overflow inside content or content wrapper. The goal is to have the content wrapper container, which takes up the remaining space and limits the containing content-div, which should take up 100% height of the content wrapper and not pushing the height of the main-wrapper. As you can see at the updated snippet the main-wrapper is clearly larger than 200px due to the content area stretching the content-wrapper. So how to fix the problem with the given parameters of not using an overflow property inside content-wrapper and a content blackbox div.