Skip to content

Instantly share code, notes, and snippets.

@kaspar-allenbach
Last active December 17, 2019 13:05
Show Gist options
  • Save kaspar-allenbach/7be21ebd592508aeff74f5208238be32 to your computer and use it in GitHub Desktop.
Save kaspar-allenbach/7be21ebd592508aeff74f5208238be32 to your computer and use it in GitHub Desktop.
scss grid offset loop
// ----
// Sass (vundefined)
// Compass (vundefined)
// dart-sass (v1.18.0)
// ----
$gridBaseNumber: 12;
//make span grid column classes
@for $i from 1 through $gridBaseNumber {
$spanVar: $i;
//generate all span classes
.widthSpan#{$i} {
grid-column: span $spanVar;
//within the span loop create all offset loops for each span option
@for $i from 1 through $gridBaseNumber {
$offsetVar: $i;
&.widthOffset#{$offsetVar} {
grid-column: $i #{"/"} span $spanVar;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment