Skip to content

Instantly share code, notes, and snippets.

@timhtheos
Last active August 24, 2016 10:49
Show Gist options
  • Save timhtheos/12a5887ce6d66ced1a49c3316b716ca7 to your computer and use it in GitHub Desktop.
Save timhtheos/12a5887ce6d66ced1a49c3316b716ca7 to your computer and use it in GitHub Desktop.
SASS mixin for css display flex.
/**
* Mixin to display flex.
*/
@mixin display-flex() {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
/**
* Mixin to flex order.
*/
@mixin flex-order($order) {
-webkit-box-ordinal-group: #{$order}; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-ordinal-group: #{$order}; /* OLD - Firefox 19- */
-ms-flex-order: #{$order}; /* TWEENER - IE 10 */
-webkit-order: #{$order}; /* NEW - Chrome */
order: #{$order}; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
/**
* Mixin for other flex properties.
*/
@mixin flex($prop, $val) {
-webkit-#{$prop}: #{$val}; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-#{$prop}: #{$val}; /* OLD - Firefox 19- (buggy but mostly works) */
#{$prop}: #{$val}; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment