I am working on a layout that consists markup and styling below (live demo https://codepen.io/IljaDaderko/pen/MWwLgVr) It all works well I have my header and footer with fixed heights and content area auto expanding to fill rest of the space.
Inside content area I have a div that fills up all it's parent space and adds overflow-x: scroll
. My initial assumption was that if I add a bunch of Content <br />
inside of it I would still see my footer and be able to scroll down, however it keeps expanding content area (see live demo #2 https://codepen.io/IljaDaderko/pen/MWwLgBQ).
Is it possible to keep that footer at the bottom (without making it fixed), while making content area auto expand and utalising scroll container? Reason to keep scroll container is that it will be reusable component in a framework I use.
CSS
.container {
width: 100vw;
height: 100vh;
background: pink;
display: flex;
flex-direction: column;
}
.header {
background: magenta;
height: 50px;
}
.content {
flex-grow: 1;
}
.footer {
background: lightgreen;
height: 30px;
}
.scroll {
height: 100%;
width: 100%;
overflow-x: scroll;
}
HTML
<div class="container">
<div class="header">Header</div>
<div class="content">
<div class="scroll">
Content
</div>
</div>
<div class="footer">Footer</div>
</div>