Skip to content

Instantly share code, notes, and snippets.

@babsgosgens
Last active December 20, 2015 17:59
Show Gist options
  • Save babsgosgens/6172522 to your computer and use it in GitHub Desktop.
Save babsgosgens/6172522 to your computer and use it in GitHub Desktop.
Mixin column spacing. Uses padding by default, but can be overridden to use margins instead - helpful when assigning backgrounds or borders.
@mixin column-spacing($fraction: 1/2, $use-margin: false, $persistent: false)
{
@if ($use-margin) {
margin-left: horizontal-rhythm($fraction);
margin-right: horizontal-rhythm($fraction);
@if $persistent == false {
@if $column-breakpoint {
@include breakpoint( $column-breakpoint ) {
margin-left: horizontal-rhythm($fraction/2);
margin-right: horizontal-rhythm($fraction/2);
}
}
}
}
@else {
padding-left: horizontal-rhythm($fraction);
padding-right: horizontal-rhythm($fraction);
@if $persistent == false {
@if $column-breakpoint {
@include breakpoint( $column-breakpoint ) {
padding-left: horizontal-rhythm($fraction/2);
padding-right: horizontal-rhythm($fraction/2);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment