Skip to content

Instantly share code, notes, and snippets.

@josephdburdick
Created June 1, 2015 04:38
Show Gist options
  • Select an option

  • Save josephdburdick/bed33b681886116f6d79 to your computer and use it in GitHub Desktop.

Select an option

Save josephdburdick/bed33b681886116f6d79 to your computer and use it in GitHub Desktop.
Awesome Sass helpers for positioning
/*****************************************************************************/
/* Stylesheet Helpers */
/*****************************************************************************/
$units: px, rem, vh, vw;
$sizes: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 65, 70, 75, 80, 85, 90, 95, 100;
$positions: relative, absolute, fixed, sticky;
$directions: top, left, bottom, right;
@each $position in $positions{
.position-#{$position}{
position: $position;
}
@each $direction in $directions{
.position-#{$position}--#{$direction}{
position: #{$position};
#{$direction}: 0;
}
@each $unit in $units{
@each $size in $sizes{
.margin-#{$direction}--#{$size}#{$unit}{
margin-#{$direction}: #{$size}#{$unit};
}
.margin-#{$direction}--minus-#{$size}#{$unit}{
margin-#{$direction}: -#{$size}#{$unit};
}
.#{$direction}--#{$size}#{$unit}{
#{$direction}: #{$size}#{$unit};
}
.#{$direction}--minus-#{$size}#{$unit}{
#{$direction}: -#{$size}#{$unit};
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment