Skip to content

Instantly share code, notes, and snippets.

@MarioAraque
Last active August 29, 2015 14:04
Show Gist options
  • Save MarioAraque/17c7805dc23f040e9468 to your computer and use it in GitHub Desktop.
Save MarioAraque/17c7805dc23f040e9468 to your computer and use it in GitHub Desktop.
Vertical center with 3 lines of code
<div class="content">
<div class="vertical-center">Example content</div>
</div>
.content {
height: 300px; //Necessary to correct work
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
backgrount-color: #f4f4f4;
.vertical-center {
position: relative;
top: 50%;
transform: translateY(-50%);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment