actually , a very possible duplicate of Fill remaining vertical space with CSS using display:flex
You may take a look at flex and flex-grow.
body {
display:flex;
flex-flow:column;
min-height:100vh;
margin:0;
}
#main-container {
flex:1;
}
#footer {}
/* = */
#header { background-color: yellow; }
#main-container { background-color: red; }
#footer { background-color: green; }
<div id="header">Header</div>
<div id="main-container" contentEditable>
Hello<br>
World
</div>
<div id="footer">
Bye-bye.
</div>
usefull link : https://css-tricks.com/snippets/css/a-guide-to-flexbox/