Skip to content

Instantly share code, notes, and snippets.

@floster
Created January 4, 2016 07:55
Show Gist options
  • Save floster/220046da18650bae9243 to your computer and use it in GitHub Desktop.
Save floster/220046da18650bae9243 to your computer and use it in GitHub Desktop.
vertical align with Flex
/* Vertical align */
.d-flex-vertical {
/* Tell flexbox to start vertically from the center */
align-items:center;
display:flex;
/* I'm also aligning it horizontally */
justify-content:center;
}
/* all the child element needs is to be a flex item */
.d-flex-vertical > div {
display:flex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment