Skip to content

Instantly share code, notes, and snippets.

@YohannParis
Created July 5, 2013 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save YohannParis/5935398 to your computer and use it in GitHub Desktop.
Save YohannParis/5935398 to your computer and use it in GitHub Desktop.
To horizontally and vertically center an element in css: http://css-tricks.com/centering-percentage-widthheight-elements/
/*
* To horizontally and vertically center an element in css:
* http://css-tricks.com/centering-percentage-widthheight-elements/
*/
.center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 20em;
height: 20em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment