Created
December 8, 2016 15:58
-
-
Save tristen/650c6bd6dfe55d5d272dc251b8c2387f to your computer and use it in GitHub Desktop.
Vertically aligned items in Flexbox
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='utf-8' /> | |
<title></title> | |
<meta name='viewport' content='width=device-width, initial-scale=1'> | |
<style> | |
body { margin:0; padding:0; background-color:#eee; } | |
.bg-grey { background-color:#ccc; } | |
.align { | |
display: flex; | |
align-items: center; | |
min-height: 100vh; | |
justify-content: center; | |
} | |
.align-item { | |
flex: 1; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='align'> | |
<div class='align-item bg-grey'>I am aligned</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment