Skip to content

Instantly share code, notes, and snippets.

@RajaJaganathan
Last active December 10, 2015 05:46
Show Gist options
  • Save RajaJaganathan/a8fe63cd291a1a06e517 to your computer and use it in GitHub Desktop.
Save RajaJaganathan/a8fe63cd291a1a06e517 to your computer and use it in GitHub Desktop.
Vertically/Horizontal center a content block:
(IE9+)
.center-horizontal {
position: relative;
left: 50%;
transform: translateX(-50%);
}
.center-vertical {
position: relative;
top: 50%;
transform: translateY(-50%);
}
.abs-center {
position: absolute;
top: 50%;
left: 50%;
transform:translate(-50%,-%50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment