Vertical flexbox

Header sized to content, with fixed footer, and content region that fills the remaining space.

by spitfire378

HTML

<div class="parent">
  <div class="child child-1">1</div>
  <div class="child child-2">2</div>
</div>

CSS

body, html, .parent {
  height: 100%;
}

.parent{
  display: flex;
  flex-direction: column;
}

.child {
  padding: 15px;
  text-align: center;
  color: white;
}

.child-1 {
  background-color: red;
  flex: 0 1;
}

.child-2 {
  background-color: blue;
  flex: 0 2;
}