Skip to content

Instantly share code, notes, and snippets.

@eduardoboucas
Created January 12, 2015 22:19
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 eduardoboucas/d7f1555c52c33a37a538 to your computer and use it in GitHub Desktop.
Save eduardoboucas/d7f1555c52c33a37a538 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
$grid-granularity: 4 !default;
$widths: ();
@for $i from 1 through $grid-granularity {
@for $j from 1 through $i {
$newWidth: unquote('.col-#{$j}-#{$i}');
$width: $j/$i;
@if (map-has-key($widths, $width)) {
$newWidth: append(map-get($widths, $width), $newWidth, comma);
} @else {
$newWidth: $newWidth;
}
$widths: map-merge($widths, ($width: $newWidth));
}
}
@each $grid-granularity in $widths {
$key: nth($grid-granularity, 1);
$value: nth($grid-granularity, 2);
#{$value} {
width: $key * 100%;
}
}
.col-1-1, .col-2-2, .col-3-3, .col-4-4 {
width: 100%;
}
.col-1-2, .col-2-4 {
width: 50%;
}
.col-1-3 {
width: 33.33333%;
}
.col-2-3 {
width: 66.66667%;
}
.col-1-4 {
width: 25%;
}
.col-3-4 {
width: 75%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment