Sha256: be8cc3da901d669e617b101c7b9664b85f01d13155d5940d2bb6324fa379dbbb

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

@charset "UTF-8";

/// Provides a concise, one-line method for setting an element’s positioning
/// properties: `position`, `top`, `right`, `bottom` and `left`. Use a `null`
/// value to “skip” an edge of the box.
///
/// @argument {string} $position
///   A CSS position value.
///
/// @argument {list} $box-edge-values
///   List of lengths; accepts CSS shorthand.
///
/// @example scss
///   .element {
///     @include position(relative, 0 null null 10em);
///   }
///
///   // CSS Output
///   .element {
///     left: 10em;
///     position: relative;
///     top: 0;
///   }
///
/// @example scss
///   .element {
///     @include position(absolute, 0);
///   }
///
///   // CSS Output
///   .element {
///     position: absolute;
///     top: 0;
///     right: 0;
///     bottom: 0;
///     left: 0;
///   }
///
/// @require {function} _is-length
///
/// @require {function} _unpack-shorthand

@mixin position(
    $position,
    $box-edge-values
  ) {

  $box-edge-values: _unpack-shorthand($box-edge-values);

  $offsets: (
    top:    nth($box-edge-values, 1),
    right:  nth($box-edge-values, 2),
    bottom: nth($box-edge-values, 3),
    left:   nth($box-edge-values, 4),
  );

  position: $position;

  @each $offset, $value in $offsets {
    @if _is-length($value) {
      #{$offset}: $value;
    }
  }
}

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
spice-rack-0.4.0 _sass/bourbon/bourbon/library/_position.scss
spice-rack-0.3.0 _sass/bourbon/bourbon/library/_position.scss
spice-rack-0.2.0 _sass/bourbon/bourbon/library/_position.scss
spice-rack-0.1.0 _sass/bourbon/bourbon/library/_position.scss
bourbon-5.0.0.beta.7 core/bourbon/library/_position.scss