Skip to content

Instantly share code, notes, and snippets.

@tinkertrain
Created August 16, 2013 16:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tinkertrain/6251588 to your computer and use it in GitHub Desktop.
Save tinkertrain/6251588 to your computer and use it in GitHub Desktop.
@mixin _position($position, $args) {
$offsets: top right bottom left;
@each $o in $offsets {
$i: index($args, $o);
@if $i
and $i + 1 <= length($args)
and type-of( nth($args, $i + 1) ) == number {
#{$o}: nth($args, $i + 1);
}
}
position: $position;
}
/**
* Mixin triplet calling the private mixin
* with the appropriate position value
*/
@mixin absolute($args) {
@include _position(absolute, $args);
}
@mixin relative($args) {
@include _position(relative, $args);
}
@mixin fixed($args) {
@include _position(fixed, $args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment