I would like to make the content overflow, but not the whole page. My issue is that I can't figure out how to make the content height depend on footer (and potential other elements like header) without hard-code how much horizontal space these take. How do I make the content take up as much horizontal space as available, but nothing more, and then overflow the rest?
My thinking is that I might be able to do it by simply locking the content height and use @media to create a couple of different heights given different resolutions.
Below is a minimal example that I made, where I have the overflow on the whole page. This is not what I want. I would like to have the content to only take up the space that is left after every other element is on the page and then overflow its content (removing overflow on main).
Please advice
In the example.
body {margin: 0; padding: 0;
}
main, footer {color: #ffffff;}
main {
background: #000000;
}
.main {
max-height: 100%;
}
.content {
background: blue;
overflow-y: auto;
height: auto;
}
.footer {
background: #616161;
height: 100px;
width: 100%;
}
.boxes {
background-color: yellow;
width: 95%;
height: 250px;
margin: 5px;
}
<main>Main
<div class="main">
<section class="content">
<div class="boxes">1</div>
<div class="boxes">2</div>
<div class="boxes">3</div>
</section>
</div>
<footer class="footer">Footer</footer>
</main>