Skip to content

Instantly share code, notes, and snippets.

@yuchant
Created December 29, 2013 06:32
Show Gist options
  • Save yuchant/8168043 to your computer and use it in GitHub Desktop.
Save yuchant/8168043 to your computer and use it in GitHub Desktop.
$grid_columns: 12;
@mixin responsive-gutters {
padding-right: $touch-gutter/2;
padding-left: $touch-gutter/2;
@include breakpoint($bp-desktop) {
padding-right: $desktop-gutter/2;
padding-left: $desktop-gutter/2;
}
}
@function calculate-width($col) {
@return ($col/$grid_columns) * 100%;
}
@mixin column($col) {
width: calculate-width($col);
float: left;
@include responsive-gutters;
}
@mixin isolation-span($col-span, $start) {
/*
Isolation span: give column span width and start position.
*/
$start: $start - 1;
@include column($col-span);
clear: none;
@if ($col-span + $start == $grid_columns) {
// if last column, float right;
float: right;
} @else {
margin-left: calculate-width($start);
}
}
@for $i from 1 through 12 {
.g#{$i} {
@include column($i);
}
}
@mixin row() {
@include clearfix;
$gutter: -1 * $touch-gutter/2;
margin: 0 $gutter 0 $gutter;
@include breakpoint($bp-desktop) {
$gutter: -1 * $desktop-gutter/2;
margin: 0 $gutter 0 $gutter;
}
}
.row {
@include row;
}
.container {
margin: 0 auto;
min-width: 700px;
max-width: 1440px;
padding-left: $touch-gutter;
padding-right: $touch-gutter;
@include clearfix;
@include breakpoint($bp-desktop) {
// at desktop, double the gutter (percentage)
padding-left: $desktop-gutter * 2;
padding-right: $desktop-gutter * 2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment