How can I make a div fill up the remaining vertical space using display: flex?
In my example below, the main element should fill up all space not used by the nav. If this worked correctly, we wouldn't see any red.
HTML:
<nav></nav>
<main></main>
CSS:
body {
height: 100%;
display: flex;
flex-direction: column;
background: red;
margin: 0;
}
nav {
height: 40px;
background: orange;
}
main {
display: flex;
flex: 1;
background: purple;
}