Skip to content

Instantly share code, notes, and snippets.

@vanderb
Last active April 9, 2019 13:14
Show Gist options
  • Save vanderb/f8bc4ecd13d6ba72271fd05f7239e47a to your computer and use it in GitHub Desktop.
Save vanderb/f8bc4ecd13d6ba72271fd05f7239e47a to your computer and use it in GitHub Desktop.
Responsive Spacer-Mixin for foundation 6
$spaceamounts: (0, 5, 10, 15, 20, 30, 40, 50); // Adjust this to include the pixel amounts you need.
$sides: (top, bottom);
$space-attr: ("margin", "padding"); // margin or padding
@each $breakpoint in $breakpoint-classes {
@if $breakpoint == 'small' {
@each $space in $spaceamounts {
@each $side in $sides {
@each $attr in $space-attr {
.#{str-slice($attr, 0, 1)}#{str-slice($side, 0, 1)}-#{$space} {
#{$attr}-#{$side}: rem-calc($space) !important;
}
}
}
}
} @else {
@include breakpoint($breakpoint) {
@each $space in $spaceamounts {
@each $side in $sides {
@each $attr in $space-attr {
.#{$breakpoint}-#{str-slice($attr, 0, 1)}#{str-slice($side, 0, 1)}-#{$space} {
#{$attr}-#{$side}: rem-calc($space) !important;
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment