Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active August 29, 2015 14:14
Show Gist options
  • Save robneu/908b9477335ac6c07aa9 to your computer and use it in GitHub Desktop.
Save robneu/908b9477335ac6c07aa9 to your computer and use it in GitHub Desktop.
Create a mobile-first, gutterless grid system using Sass
/* Table Grid Classes
--------------------------------------------- */
@media screen and (min-width: 810px) {
%table-grid {
display: block;
float: left;
}
.table-one-half,
.table-three-sixths,
.table-two-fourths {
@extend %table-grid;
width: percentage(1/2);
}
.table-one-third,
.table-two-sixths {
@extend %table-grid;
width: percentage(1/3);
}
.table-four-sixths,
.table-two-thirds {
@extend %table-grid;
width: percentage(2/3);
}
.table-one-fourth {
@extend %table-grid;
width: percentage(1/4);
}
.table-three-fourths {
@extend %table-grid;
width: percentage(3/4);
}
.table-one-sixth {
@extend %table-grid;
width: percentage(1/6);
}
.table-five-sixths {
@extend %table-grid;
width: percentage(5/6);
}
}
<div id="my-block-1" class="my-block table-one-third">
<p>Yay! Grids!</p>
</div>
<div id="my-block-2" class="my-block table-two-thirds">
<p>Yay! Grids!</p>
</div>
@robneu
Copy link
Author

robneu commented Feb 2, 2015

Example use:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment