Skip to content

Instantly share code, notes, and snippets.

@joshuaadrian
Last active August 29, 2015 14:01
Show Gist options
  • Save joshuaadrian/dd8e4c5f0bf699dff157 to your computer and use it in GitHub Desktop.
Save joshuaadrian/dd8e4c5f0bf699dff157 to your computer and use it in GitHub Desktop.
Simple SASS grid system meant to be light weight and easy to use
/************************************************************************/
/* GRID VARIABLES
/************************************************************************/
$grid-gutter-width : 15px;
$grid-column-amount : 12;
$grid-large-breakpoint : 1200px;
$grid-medium-breakpoint : 992px;
$grid-small-breakpoint : 768px;
/************************************************************************/
/* GRID SYSTEM
/************************************************************************/
.grid-container {
margin : 0 auto;
padding : 0 $grid-gutter-width;
}
.grid-row {
margin : 0 (-$grid-gutter-width);
}
.grid-column {
padding : 0 $grid-gutter-width;
margin : $grid-gutter-width 0;
}
@media ( min-width: $grid-small-breakpoint ) {
.grid-container {
width : $grid-small-breakpoint - 18px;
padding : 0;
}
.grid-row {
&:before,
&:after {
content : " ";
display : table;
}
&:after {
clear : both;
}
}
.grid-column {
float : left;
}
@for $i from 1 through $grid-column-amount {
.grid-column-#{$i} {
width : ( $i / $grid-column-amount ) * 100%;
}
.grid-column-offset-#{$i} {
margin-left : ( $i / $grid-column-amount ) * 100%;
}
}
}
@media ( min-width: $grid-medium-breakpoint ) {
.grid-container {
width : $grid-medium-breakpoint - 22px;
}
}
@media ( min-width: $grid-large-breakpoint ) {
.grid-container {
width : $grid-large-breakpoint - 30px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment