Created
February 19, 2014 11:48
-
-
Save dwayne/9090433 to your computer and use it in GitHub Desktop.
A mixin for horizontally and vertically centering a block element.
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
// http://css-tricks.com/snippets/css/exactly-center-an-imagediv-horizontally-and-vertically/ | |
@mixin exact-center($width, $height) { | |
width: $width; | |
height: $height; | |
position: absolute; | |
left: 50%; | |
top: 50%; | |
margin-left: -$width / 2; | |
margin-top: -$height / 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://css-tricks.com/snippets/css/exactly-center-an-imagediv-horizontally-and-vertically/