0
|
1 @charset "UTF-8";
|
|
2
|
|
3 /// Provides a quick method for setting an element’s position. Use a `null`
|
|
4 /// value to “skip” a side.
|
|
5 ///
|
|
6 /// @argument {string} $position [relative]
|
|
7 /// A CSS position value.
|
|
8 ///
|
|
9 /// @argument {arglist} $coordinates [null]
|
|
10 /// List of lengths, defined as CSS shorthand.
|
|
11 ///
|
|
12 /// @example scss
|
|
13 /// .element {
|
|
14 /// @include position(absolute, 0 null null 10em);
|
|
15 /// }
|
|
16 ///
|
|
17 /// // CSS Output
|
|
18 /// .element {
|
|
19 /// left: 10em;
|
|
20 /// position: absolute;
|
|
21 /// top: 0;
|
|
22 /// }
|
|
23 ///
|
|
24 /// @require {function} _is-length
|
|
25 ///
|
|
26 /// @require {function} _unpack
|
|
27
|
|
28 @mixin position(
|
|
29 $position: relative,
|
|
30 $coordinates: null
|
|
31 ) {
|
|
32
|
|
33 @if type-of($position) == list {
|
|
34 $coordinates: $position;
|
|
35 $position: relative;
|
|
36 }
|
|
37
|
|
38 $coordinates: _unpack($coordinates);
|
|
39
|
|
40 $offsets: (
|
|
41 top: nth($coordinates, 1),
|
|
42 right: nth($coordinates, 2),
|
|
43 bottom: nth($coordinates, 3),
|
|
44 left: nth($coordinates, 4),
|
|
45 );
|
|
46
|
|
47 position: $position;
|
|
48
|
|
49 @each $offset, $value in $offsets {
|
|
50 @if _is-length($value) {
|
|
51 #{$offset}: $value;
|
|
52 }
|
|
53 }
|
|
54 }
|