Skip to content

Instantly share code, notes, and snippets.

@Origame
Last active August 3, 2017 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Origame/69d086c70a5ff3641d5af6edd218536a to your computer and use it in GitHub Desktop.
Save Origame/69d086c70a5ff3641d5af6edd218536a to your computer and use it in GitHub Desktop.
CSS - Flexbox => same height divs / vertically centered content
//SAME HEIGHT + VERTICALLY CENTERED CONTENT
.parent {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
justify-content: center;
}
child {
width: 33.33%; /* Or whatever */
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex-direction: column;
justify-content: center;
}
//SAME HEIGHT
.parent {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.child {
width: 33.33%; /* Or whatever */
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment