So I was wondering if it was possible to have the html/body be at a minimum 100% height using css (somehow) and have it expand as needed? Right now I have a flexbox where the body takes up the remaining space (as expected).
On a live website, the body may not take up the entire page, so I want the flexbox to fill it up and to have the footer be stuck at the bottom, but when displayed on smaller screens (i.e. mobile) it will most likely fill past the visible screen. At this point (or if the body ends up filling the screen anyway), I'd like the footer to continue down on its merry way.
Without drawing borders onto the flexbox container, it seems to work as intended. But for speculative reasons, where the bordering/size of the container may be important, is it possible to have it be draw correctly (ignoring the fact that the overflow is just showing seems like a hacky job).
I will also accept javascript answers for now, but CSS will be most optimal
html, body {
height: 100%;
}
.wrapper {
display: flex;
flex-direction: column;
border: 1px solid black;
height: 100%;
}
.body {
flex: 1;
min-height: 300px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrapper">
<header style="background-color: lightblue">
header
</header>
<div class="body" style="background-color: orange; opacity: 0.3">
body
</div>
<footer style="background-color: yellow">
footer
</footer>
</div>