JSFiddle - React, Tailwind, and code Playground

by capiono

HTML

<div>
  <div class="content">
    <h1>Sticky Footer with Flexbox</h1>
  </div>

  <footer class="footer">
    Footer
  </footer>
</div>

CSS

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  /* Avoid the IE 10-11 `min-height` bug. */
}

.content {
  flex: 1 0 auto;
  /* Prevent Chrome, Opera, and Safari from letting these items shrink to smaller than their content's default minimum size. */
  padding: 20px;
}

.footer {
  flex-shrink: 0;
  /* Prevent Chrome, Opera, and Safari from letting these items shrink to smaller than their content's default minimum size. */
  padding: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 16px Sans-Serif;
}

h1 {
  margin: 0 0 20px 0;
}

p {
  margin: 0 0 20px 0;
}

footer {
  background: #42A5F5;
  color: white;
}