Skip to content

Instantly share code, notes, and snippets.

@ryangoree
Last active October 11, 2021 09:22
Show Gist options
  • Save ryangoree/357cb5d0caf52c3ef87108c484812722 to your computer and use it in GitHub Desktop.
Save ryangoree/357cb5d0caf52c3ef87108c484812722 to your computer and use it in GitHub Desktop.
Sass Grid Mixin
@mixin grid($cols, $rowGap: 0, $colGap: 0, $flexGrow: false) {
display: flex;
gap: #{$rowGap}px #{$colGap}px;
flex-wrap: wrap;
.col {
flex-basis: calc((100% - #{$colGap}px * (#{$cols} - 1)) / #{$cols});
@if $flexGrow == true {
flex-grow: 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment