Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claudia-romano/6bfec84a3c3b09d815ef11d1b7f93d1a to your computer and use it in GitHub Desktop.
Save claudia-romano/6bfec84a3c3b09d815ef11d1b7f93d1a to your computer and use it in GitHub Desktop.
@mixin gridLayout($cols...) {
$i: 1;
@each $col in $cols {
> :nth-of-type(#{$i}) {
width: calc( #{round-width(nth($col,1))} - #{$gap-horizontal});
}
$i: $i + 1;
}
@supports(grid-area: auto) {
grid-template-columns: repeat($grid-columns, 1fr);
$i: 1;
@each $col in $cols {
> :nth-of-type(#{$i}) {
grid-column-end: span nth($col,1);
@if length($col) > 1 {
grid-row-end: span nth($col,2);
}
}
$i: $i + 1;
}
> :nth-child(n) {
width: auto;
margin: 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment