Created
July 5, 2013 15:43
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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