Skip to content

Instantly share code, notes, and snippets.

@jyek
Last active August 29, 2015 14:05
Show Gist options
  • Save jyek/e04cf59e9dcf823806da to your computer and use it in GitHub Desktop.
Save jyek/e04cf59e9dcf823806da to your computer and use it in GitHub Desktop.
CSS Tricks
// Center vertical
.center-vertical {
position: relative;
top: 50%;
transform: translateY(-50%);
}
// Center horizontal
.center-horizontal {
position: relative;
left: 50%;
transform: translateX(-50%);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment