Skip to content

Instantly share code, notes, and snippets.

@souporserious
Created April 24, 2014 15:04
Show Gist options
  • Save souporserious/11258064 to your computer and use it in GitHub Desktop.
Save souporserious/11258064 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// ----
$base_font: 18;
$container: 1140;
@function gr($content_width) {
$phi: (1 + sqrt(5)) / 2;
$x: 1 / (2 * $phi);
$y: $base_font * $phi;
$z: $content_width / ($y * $y);
$h: $phi - $x * (1 - $z);
$l: $base_font * $h;
@return round($l) + px;
}
$columns: 12 !default;
$margin: 1.25 !default;
$class-slug: col !default;
@mixin calculate-grid() {
[class*="col-"] {
[class*="col-"] {
margin: 0 percentage($margin/100) 0;
}
}
// lets iterate through each column and create a class for it
@for $i from 1 through $columns {
//CAN WE CONVERT THIS TO A REAL WIDTH ? BASED ON CONTENT WRAPPER?
$gw: $i / ($columns/100);
$rw: $gw - $margin/100 * 2;
$px: ($rw/100)*$container;
.#{$class-slug}-#{$i} {
width: $rw * 1%;
line-height: gr($px);
}
.collapse {
.#{$class-slug}-#{$i} {
width: $gw * 1%;
}
}
}
}
@include calculate-grid;
[class*="col-"] [class*="col-"] {
margin: 0 1.25% 0;
}
.col-1 {
width: 8.3083333333%;
line-height: 24px;
}
.collapse .col-1 {
width: 8.3333333333%;
}
.col-2 {
width: 16.6416666667%;
line-height: 25px;
}
.collapse .col-2 {
width: 16.6666666667%;
}
.col-3 {
width: 24.975%;
line-height: 25px;
}
.collapse .col-3 {
width: 25%;
}
.col-4 {
width: 33.3083333333%;
line-height: 26px;
}
.collapse .col-4 {
width: 33.3333333333%;
}
.col-5 {
width: 41.6416666667%;
line-height: 27px;
}
.collapse .col-5 {
width: 41.6666666667%;
}
.col-6 {
width: 49.975%;
line-height: 27px;
}
.collapse .col-6 {
width: 50%;
}
.col-7 {
width: 58.3083333333%;
line-height: 28px;
}
.collapse .col-7 {
width: 58.3333333333%;
}
.col-8 {
width: 66.6416666667%;
line-height: 29px;
}
.collapse .col-8 {
width: 66.6666666667%;
}
.col-9 {
width: 74.975%;
line-height: 29px;
}
.collapse .col-9 {
width: 75%;
}
.col-10 {
width: 83.3083333333%;
line-height: 30px;
}
.collapse .col-10 {
width: 83.3333333333%;
}
.col-11 {
width: 91.6416666667%;
line-height: 30px;
}
.collapse .col-11 {
width: 91.6666666667%;
}
.col-12 {
width: 99.975%;
line-height: 31px;
}
.collapse .col-12 {
width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment