Skip to content

Instantly share code, notes, and snippets.

@nex3
Forked from chriseppstein/this_does_not_work.scss
Last active December 17, 2015 23:19
Show Gist options
  • Save nex3/5688559 to your computer and use it in GitHub Desktop.
Save nex3/5688559 to your computer and use it in GitHub Desktop.
@mixin clearfix {
*zoom: 1;
&:after {
content: "";
display: table;
clear: both;
}
}
@mixin generate-grid($cols, $width) {
%grid-base {
float: left;
@include clearfix;
}
@for $i from 1 through $cols {
.col-#{$i} {
@extend %grid-base;
width: $width * $i / $cols;
}
}
}
@media (all) and (min-width: 480px) {
@include generate-grid(12, 720px);
}
@media (all) and (min-width: 800px) {
@include generate-grid(24, 960px);
}
@mixin clearfix {
*zoom: 1;
&:after {
content: "";
display: table;
clear: both;
}
}
@mixin generate-grid($cols, $width) {
$base: unique();
$selectors: ();
@for $i from 1 through $cols {
$selectors: append($selectors, unquote(".col-#{$i}"), comma);
.col-#{$i} {
width: $width * $i / $cols;
}
}
#{$selectors} {
float: left;
@include clearfix;
}
}
@media (all) and (min-width: 480px) {
@include generate-grid(12, 720px);
}
@media (all) and (min-width: 800px) {
@include generate-grid(24, 960px);
}
@mixin clearfix {
*zoom: 1;
&:after {
content: "";
display: table;
clear: both;
}
}
@mixin generate-grid($cols, $width) {
$base: unique-id();
%#{$base} {
float: left;
@include clearfix;
}
@for $i from 1 through $cols {
.col-#{$i} {
@extend %#{$base};
width: $width * $i / $cols;
}
}
}
@media (all) and (min-width: 480px) {
@include generate-grid(12, 720px);
}
@media (all) and (min-width: 800px) {
@include generate-grid(24, 960px);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment