| 1 |
@charset "UTF-8"; |
| 2 |
|
| 3 |
/// Provides a quick method for setting an element’s position. Use a `null` value to “skip” a side. |
| 4 |
/// |
| 5 |
/// @param {Position} $position [relative] |
| 6 |
/// A CSS position value |
| 7 |
/// |
| 8 |
/// @param {Arglist} $coordinates [null null null null] |
| 9 |
/// List of values that correspond to the 4-value syntax for the edges of a box |
| 10 |
/// |
| 11 |
/// @example scss - Usage |
| 12 |
/// .element { |
| 13 |
/// @include position(absolute, 0 null null 10em); |
| 14 |
/// } |
| 15 |
/// |
| 16 |
/// @example css - CSS Output |
| 17 |
/// .element { |
| 18 |
/// left: 10em; |
| 19 |
/// position: absolute; |
| 20 |
/// top: 0; |
| 21 |
/// } |
| 22 |
/// |
| 23 |
/// @require {function} is-length |
| 24 |
/// @require {function} unpack |
| 25 |
|
| 26 |
@mixin position($position: relative, $coordinates: null null null null) { |
| 27 |
@if type-of($position) == list { |
| 28 |
$coordinates: $position; |
| 29 |
$position: relative; |
| 30 |
} |
| 31 |
|
| 32 |
$user-deprecation-warnings-setting: $output-bourbon-deprecation-warnings; |
| 33 |
$output-bourbon-deprecation-warnings: false !global; |
| 34 |
$coordinates: unpack($coordinates); |
| 35 |
|
| 36 |
$offsets: ( |
| 37 |
top: nth($coordinates, 1), |
| 38 |
right: nth($coordinates, 2), |
| 39 |
bottom: nth($coordinates, 3), |
| 40 |
left: nth($coordinates, 4) |
| 41 |
); |
| 42 |
|
| 43 |
position: $position; |
| 44 |
|
| 45 |
@each $offset, $value in $offsets { |
| 46 |
@if is-length($value) { |
| 47 |
#{$offset}: $value; |
| 48 |
} |
| 49 |
} |
| 50 |
$output-bourbon-deprecation-warnings: $user-deprecation-warnings-setting !global; |
| 51 |
} |