HEX
Server: Apache/2.4.41
System: Linux mainweb 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: nationalmedicaregrp (1119)
PHP: 8.3.7
Disabled: exec,passthru,shell_exec,system,popen,proc_open,pcntl_exec
Upload Files
File: /home/demo/public_html/roofleak/assets/scss/mixins/_position.scss
@charset "UTF-8";

/// Provides a quick method for setting an element’s position. Use a `null`
/// value to “skip” a side.
///
/// @argument {string} $position [relative]
///   A CSS position value.
///
/// @argument {arglist} $coordinates [null]
///   List of lengths, defined as CSS shorthand.
///
/// @example scss
///   .element {
///     @include position(absolute, 0 null null 10em);
///   }
///
///   // CSS Output
///   .element {
///     left: 10em;
///     position: absolute;
///     top: 0;
///   }
///
/// @require {function} _is-length
///
/// @require {function} _unpack

@mixin position(
    $position: relative,
    $coordinates: 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;
    }
  }
}