Created
December 24, 2016 14:20
-
-
Save YeomanYe/94d7e3cbb804a1f4f7d471d2a46c3d7d to your computer and use it in GitHub Desktop.
CSS:layout halignCenterByFlexbox
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
/*当我们使用 Flexbox 时, margin: auto 不仅在水平方向上将元素居中, 垂直方向上也是如此*/ | |
body { | |
display: flex; | |
min-height: 100vh; | |
margin: 0; | |
} | |
main { | |
margin: auto; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment