Skip to content

Instantly share code, notes, and snippets.

@ellenbo
Last active November 14, 2017 21:27
Show Gist options
  • Save ellenbo/df76093aa32c1a130327cef82d10c908 to your computer and use it in GitHub Desktop.
Save ellenbo/df76093aa32c1a130327cef82d10c908 to your computer and use it in GitHub Desktop.
Space two items in a flexbox with the left and right edges aligned with the outer container.
.flex-container {
padding: 0;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-align-items: stretch;
-ms-flex-align: stretch;
align-items: stretch;
}
.flex-half-left {
width: 49%;
padding-right: 1%;
-webkit-order: 0;
-ms-flex-order: 0;
order: 0;
-webkit-flex: 0 1 auto;
-ms-flex: 0 1 auto;
flex: 0 1 auto;
-webkit-align-self: auto;
-ms-flex-item-align: auto;
align-self: auto;
}
.flex-half-right {
width: 49%;
padding-left: 1%;
text-align: right;
-webkit-order: 1;
-ms-flex-order: 1;
order: 1;
-webkit-flex: 0 1 auto;
-ms-flex: 0 1 auto;
flex: 0 1 auto;
-webkit-align-self: auto;
-ms-flex-item-align: auto;
align-self: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment