Skip to content

Instantly share code, notes, and snippets.

@benjamindean
Created April 4, 2014 08:20
Show Gist options
  • Save benjamindean/9970340 to your computer and use it in GitHub Desktop.
Save benjamindean/9970340 to your computer and use it in GitHub Desktop.
Creates absolute position width SASS. Example: @include abs-pos(0 5px 0 0px);
@mixin abs-pos($coordinates: 0 0 0 0) {
$top: nth($coordinates, 1);
$right: nth($coordinates, 2);
$bottom: nth($coordinates, 3);
$left: nth($coordinates, 4);
@if not(unitless($top)) {
top: $top;
}
@if not(unitless($right)) {
right: $right;
}
@if not(unitless($bottom)) {
bottom: $bottom;
}
@if not(unitless($left)) {
left: $left;
}
position: absolute;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment