Last active
November 10, 2016 16:17
-
-
Save carlos-sanchez/7634720 to your computer and use it in GitHub Desktop.
Absolute Center with flexbox.
Content can be any width or height, even overflows gracefully
No IE8-9 support
Requires a container or styles on the body
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
.Center-Container.is-Flexbox { | |
display: -webkit-box; | |
display: -moz-box; | |
display: -ms-flexbox; | |
display: -webkit-flex; | |
display: flex; | |
-webkit-box-align: center; | |
-moz-box-align: center; | |
-ms-flex-align: center; | |
-webkit-align-items: center; | |
align-items: center; | |
-webkit-box-pack: center; | |
-moz-box-pack: center; | |
-ms-flex-pack: center; | |
-webkit-justify-content: center; | |
justify-content: center; | |
} |
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
.parent{ | |
display: flex; | |
} | |
.child{ | |
margin: auto; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment