Skip to content

Instantly share code, notes, and snippets.

@hilja
Created March 7, 2015 17:40
Show Gist options
  • Save hilja/f1ed97e557370765a0be to your computer and use it in GitHub Desktop.
Save hilja/f1ed97e557370765a0be to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
- (1..12).each do |i|
%div{:class => "item-"#{i}}
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
// 12 column grid
$cols: 12;
// Column widths as percentages
$col-width: percentage(1 / $cols);
@for $i from 1 through $cols {
.col-#{$cols} {
width: $col-width * $i;
}
// Iterate the counter
$cols: $cols - 1;
}
.col-12 {
width: 8.33333%;
}
.col-11 {
width: 16.66667%;
}
.col-10 {
width: 25.0%;
}
.col-9 {
width: 33.33333%;
}
.col-8 {
width: 41.66667%;
}
.col-7 {
width: 50.0%;
}
.col-6 {
width: 58.33333%;
}
.col-5 {
width: 66.66667%;
}
.col-4 {
width: 75.0%;
}
.col-3 {
width: 83.33333%;
}
.col-2 {
width: 91.66667%;
}
.col-1 {
width: 100.0%;
}
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
<!-- /.col-=i -->
<div class='item'></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment