27 lines
541 B
SCSS
27 lines
541 B
SCSS
|
// Set element positioning in a single statement
|
||
|
|
||
|
@mixin position($position: relative, $coordinates: null null null null) {
|
||
|
|
||
|
@if type-of($position) == list {
|
||
|
$coordinates: $position;
|
||
|
$position: relative;
|
||
|
}
|
||
|
|
||
|
$coordinates: unpack($coordinates);
|
||
|
|
||
|
$offsets: (
|
||
|
top: nth($coordinates, 1),
|
||
|
right: nth($coordinates, 2),
|
||
|
bottom: nth($coordinates, 3),
|
||
|
left: nth($coordinates, 4)
|
||
|
);
|
||
|
|
||
|
position: $position;
|
||
|
|
||
|
@each $offset, $value in $offsets {
|
||
|
@if is-length($value) {
|
||
|
#{$offset}: $value;
|
||
|
}
|
||
|
}
|
||
|
}
|