Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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