Skip to content

Instantly share code, notes, and snippets.

@ztrehagem
Created April 30, 2020 09:45
Show Gist options
  • Save ztrehagem/71e99f9219a4f0ac37aeb4d91a239ba1 to your computer and use it in GitHub Desktop.
Save ztrehagem/71e99f9219a4f0ac37aeb4d91a239ba1 to your computer and use it in GitHub Desktop.
@mixin z-flow-flex($columns: 1, $margin-longitudinal: 0px, $margin-lateral: 0px, $child-selector: '*') {
display: flex;
flex-wrap: wrap;
> #{$child-selector} {
$width: calc((100% - #{$margin-lateral} * #{$columns - 1}) / #{$columns});
flex: 0 0;
flex-basis: $width;
width: $width;
margin: 0;
&:nth-child(n+#{$columns + 1}) {
margin-top: $margin-longitudinal;
}
&:not(:nth-child(#{$columns}n+1)) {
margin-left: $margin-lateral;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment