Edit in JSFiddle

<div class="contenedor">
  <header>Header</header>
  <section>
    Contenido principal.
  </section>
  <footer>Footer</footer>
</div>
body{
  padding: 0;
  margin: 0;
}
header, footer{
  padding: 20px;
  color: white;
  background-color: black;
  text-align: center;
}
section{
  padding: 20px;
  text-align: center;
}

/*soluciĆ³n con flex*/
html, body{
  height:100%;
}
.contenedor{
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
section{
  flex: 1
}