Skip to content

Instantly share code, notes, and snippets.

@lunelson
Last active December 16, 2015 22:49
Show Gist options
  • Save lunelson/5509318 to your computer and use it in GitHub Desktop.
Save lunelson/5509318 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com, the Sass playground.
// beginning of a grid-column sizing mixin
// requires compass
@mixin g-cell($n, $d, $args...) {
width: $n / $d * 100%;
// @if length($args) >= 1 { position: relative; }
@each $arg in $args {
$dir: nth($arg,1); $p: nth($arg,2);
@if $p == outside {
margin-#{opposite-position($dir)}: 100%;
margin-#{$dir}: $n / $d * -100%;
margin-bottom: -100%;
}
@else { margin-#{$dir}: $p / $d*100%; }
}
}
.test {
@include g-cell(1, 3, left outside);
}
.test2 {
@include g-cell(2, 3, right 2, left -1);
}
// @include resize-col(mobile, span 2 3, right 1, left -3);
// @include resize-col(tablet, span 1 3, right 2);
// @include resize-col(desktop, span 3 3, right outside);
// .desktop-span-6-3
// .desktop-right-plus-1-3
// .desktop-left-minus-2-3
// .desktop-right-outside
.test {
width: 33.33333%;
margin-right: 100%;
margin-left: -33.33333%;
margin-bottom: -100%;
}
.test2 {
width: 66.66667%;
margin-right: 66.66667%;
margin-left: -33.33333%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment