Skip to content

Instantly share code, notes, and snippets.

@derekbtw
Created April 23, 2017 03:15
Show Gist options
  • Save derekbtw/be4345567c01c27aaf28b216db82ce67 to your computer and use it in GitHub Desktop.
Save derekbtw/be4345567c01c27aaf28b216db82ce67 to your computer and use it in GitHub Desktop.
Align element directly in the center of the screen (vertically & horizontally) with CSS
.centered {
position: fixed;
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