Last active
June 5, 2018 19:53
-
-
Save eli-oat/d2c0813356d46e38357e3a50d3f898da to your computer and use it in GitHub Desktop.
Because I can never remember how to vertically center a div...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.outer { | |
display: table; | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
} | |
.middle { | |
display: table-cell; | |
vertical-align: middle; | |
} | |
.inner { | |
margin: 0 auto; | |
width: 400px; /* or whatever else you'd like */ | |
} | |
/* | |
Shout out to: https://stackoverflow.com/a/6182661 and http://tachyons.io/components/layout/full-screen-centered-title/index.html | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="outer"> | |
<div class="middle"> | |
<div class="inner"> | |
<h1>The Content</h1> | |
<p>Once upon a midnight dreary...</p> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment