Skip to content

Instantly share code, notes, and snippets.

@mikeplate
Created May 11, 2016 12:42
Show Gist options
  • Save mikeplate/ecc0ea3cd2916968831467206444410a to your computer and use it in GitHub Desktop.
Save mikeplate/ecc0ea3cd2916968831467206444410a to your computer and use it in GitHub Desktop.
Center something in the middle of the web page
.centered {
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment