Skip to content

Instantly share code, notes, and snippets.

@zanonnicola
Forked from YohannParis/center.css
Last active Dec 27, 2015
Embed
What would you like to do?
CSS: centering
/*
* 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