Skip to content

Instantly share code, notes, and snippets.

@MikeGillihan
Created January 20, 2015 20:02
Show Gist options
  • Save MikeGillihan/20c211e190f737f7fd43 to your computer and use it in GitHub Desktop.
Save MikeGillihan/20c211e190f737f7fd43 to your computer and use it in GitHub Desktop.
Just Another Sassy Grid
// Just Another Sassy Grid
// ---------------------------------------------
$pad: 2rem;
$base-container-width: 100rem;
$gridpad: ( $pad / $base-container-width ) * 100%;
.row {
// margin-bottom: $gridpad; // Optional row padding
@extend .clearfix;
}
.full,
.one-half,
.one-third,
.two-thirds,
.one-fourth,
.two-fourths,
.three-fourths,
.one-sixth,
.two-sixths,
.three-sixths,
.four-sixths,
.five-sixths {
float: left;
margin: 0 0 $gridpad $gridpad;
}
.full,
.first {
margin-left: 0;
}
// Add .flow-reverse class for rtl column flow
.flow-reverse {
float: right;
margin: 0 $gridpad $gridpad 0;
&.first {
margin-right: 0;
}
}
// COLUMNS
.full { width: 100%; }
.one-half { width: (100/2 + $gridpad/2) - $gridpad; }
.one-third { width: (100/3 + $gridpad/3) - $gridpad; }
.two-thirds { width: ((100/3 + $gridpad/3) * 2) - $gridpad; }
.one-fourth { width: (100/4 + $gridpad/4) - $gridpad; }
.two-fourths { width: ((100/4 + $gridpad/4) * 2) - $gridpad; }
.three-fourths { width: ((100/4 + $gridpad/4) * 3) - $gridpad; }
.one-sixth { width: (100/6 + $gridpad/6) - $gridpad; }
.two-sixths { width: ((100/6 + $gridpad/6) * 2) - $gridpad; }
.three-sixths { width: ((100/6 + $gridpad/6) * 3) - $gridpad; }
.four-sixths { width: ((100/6 + $gridpad/6) * 4) - $gridpad; }
.five-sixths { width: ((100/6 + $gridpad/6) * 5) - $gridpad; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment