Skip to content

Instantly share code, notes, and snippets.

@csswizardry
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save csswizardry/545792f7d4ba257586ca to your computer and use it in GitHub Desktop.

Select an option

Save csswizardry/545792f7d4ba257586ca to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="o-flex o-flex--center o-flex--collapse o-flex--rev o-flex--bottom">
<div class="o-flex__item"><p>One</p></div>
<div class="o-flex__item"><p>Two</p></div>
<div class="o-flex__item"><p>Thr<br />ee</p></div>
</div>
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
/**
* Set up a flexbox scope.
*/
.o-flex {
display: flex;
}
/**
* Display all items in reverse order.
*/
.o-flex--rev {
flex-direction: row-reverse;
}
/**
* Begin filling in items from the left (default).
*/
.o-flex--left {
justify-content: flex-start;
}
/**
* Begin filling in items from the right.
*/
.o-flex--right {
justify-content: flex-end;
}
/**
* Begin filling items out from the center.
*/
.o-flex--center {
justify-content: center;
}
/**
* Vertically align all items to the tops of each other (default).
*/
.o-flex--top {
align-items: flex-start;
}
/**
* Vertically align all items to the bottoms of each other.
*/
.o-flex--bottom {
align-items: flex-end;
}
/**
* Vertically align all items to the middles of each other.
*/
.o-flex--middle {
align-items: center;
}
/**
* Vertically align all items to the baselines of each other.
*/
.o-flex--baseline {
align-items: baseline;
}
/**
* Make all items stretch to become the same heights as each other.
*/
.o-flex--full {
align-items: stretch;
}
/**
* Stack flex items on top of each other.
*/
.o-flex--stack {
flex-direction: column;
/**
* Reverse the orders of stacked items.
*/
&.o-flex--rev{
flex-direction: column-reverse;
}
}
/**
* Make all items the same widths as each other by default.
*/
.o-flex__item {
flex-grow: 1;
/**
* Cause all items to occupy as little space as necessary.
*/
.o-flex--collapse > & {
flex-grow: 0;
}
}
/**
* Vertically align an item to the top of the others.
*/
.o-flex__item--top {
align-self: flex-start;
}
/**
* Vertically align an item to the bottom of the others.
*/
.o-flex__item--bottom {
align-self: flex-end;
}
/**
* Vertically align an item to the middle of the others.
*/
.o-flex__item--middle {
align-self: center;
}
/**
* Vertically align an item to the baseline of the others.
*/
.o-flex__item--baseline {
align-self: baseline;
}
/**
* Make an item stretch to become the same height as the others.
*/
.o-flex__item--full {
align-self: stretch;
}
/**
* Set up a flexbox scope.
*/
.o-flex {
display: flex;
}
/**
* Display all items in reverse order.
*/
.o-flex--rev {
flex-direction: row-reverse;
}
/**
* Begin filling in items from the left (default).
*/
.o-flex--left {
justify-content: flex-start;
}
/**
* Begin filling in items from the right.
*/
.o-flex--right {
justify-content: flex-end;
}
/**
* Begin filling items out from the center.
*/
.o-flex--center {
justify-content: center;
}
/**
* Vertically align all items to the tops of each other (default).
*/
.o-flex--top {
align-items: flex-start;
}
/**
* Vertically align all items to the bottoms of each other.
*/
.o-flex--bottom {
align-items: flex-end;
}
/**
* Vertically align all items to the middles of each other.
*/
.o-flex--middle {
align-items: center;
}
/**
* Vertically align all items to the baselines of each other.
*/
.o-flex--baseline {
align-items: baseline;
}
/**
* Make all items stretch to become the same heights as each other.
*/
.o-flex--full {
align-items: stretch;
}
/**
* Stack flex items on top of each other.
*/
.o-flex--stack {
flex-direction: column;
/**
* Reverse the orders of stacked items.
*/
}
.o-flex--stack.o-flex--rev {
flex-direction: column-reverse;
}
/**
* Make all items the same widths as each other by default.
*/
.o-flex__item {
flex-grow: 1;
/**
* Cause all items to occupy as little space as necessary.
*/
}
.o-flex--collapse > .o-flex__item {
flex-grow: 0;
}
/**
* Vertically align an item to the top of the others.
*/
.o-flex__item--top {
align-self: flex-start;
}
/**
* Vertically align an item to the bottom of the others.
*/
.o-flex__item--bottom {
align-self: flex-end;
}
/**
* Vertically align an item to the middle of the others.
*/
.o-flex__item--middle {
align-self: center;
}
/**
* Vertically align an item to the baseline of the others.
*/
.o-flex__item--baseline {
align-self: baseline;
}
/**
* Make an item stretch to become the same height as the others.
*/
.o-flex__item--full {
align-self: stretch;
}
<div class="o-flex o-flex--center o-flex--collapse o-flex--rev o-flex--bottom">
<div class="o-flex__item"><p>One</p></div>
<div class="o-flex__item"><p>Two</p></div>
<div class="o-flex__item"><p>Thr<br />ee</p></div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment