Skip to content

Instantly share code, notes, and snippets.

@galengidman
Last active November 26, 2020 17:36
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save galengidman/9840254 to your computer and use it in GitHub Desktop.
Save galengidman/9840254 to your computer and use it in GitHub Desktop.
`display: table` sticky footer trick
<header class="page-row">
<h1>Site Title</h1>
</header>
<main class="page-row page-row-expanded">
<p>Page content goes here.</p>
</main>
<footer class="page-row">
<p>Copyright, blah blah blah.</p>
</footer>
html,
body { height: 100%; }
body {
display: table;
width: 100%;
}
.page-row {
display: table-row;
height: 1px;
}
.page-row-expanded { height: 100%; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment