Sha256: 8223197a434c5f61421b27e76c35cad7d978cb75c5416ac3eaee20935569a113

Contents?: true

Size: 1.11 KB

Versions: 133

Compression:

Stored size: 1.11 KB

Contents

@charset "UTF-8";

/// Provides a quick method for setting an element’s position. Use a `null` value to “skip” a side.
///
/// @param {Position} $position [relative]
///   A CSS position value
///
/// @param {Arglist} $coordinates [null null null null]
///   List of values that correspond to the 4-value syntax for the edges of a box
///
/// @example scss - Usage
///   .element {
///     @include position(absolute, 0 null null 10em);
///   }
///
/// @example css - CSS Output
///   .element {
///     left: 10em;
///     position: absolute;
///     top: 0;
///   }
///
/// @require {function} is-length
/// @require {function} unpack

@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;
    }
  }
}

Version data entries

133 entries across 126 versions & 21 rubygems

Version Path
StyleSass-0.1.5 app/assets/stylesheets/addons/_position.scss
middleman-core-4.1.11 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss
StyleSass-0.1.5.alpha app/assets/stylesheets/addons/_position.scss
codelation_assets-0.5.0 app/assets/stylesheets/bourbon/addons/_position.scss
middleman-core-4.1.10 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss
garth-jekyll-theme-0.1.8 _sass/bourbon/addons/_position.scss
middleman-core-4.1.9 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss
middleman-core-4.1.8 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss
active_admin_pro-0.2.4 app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss
codelation_assets-0.4.0 app/assets/stylesheets/bourbon/addons/_position.scss
active_admin_pro-0.2.3 app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss
codelation_assets-0.3.9 app/assets/stylesheets/bourbon/addons/_position.scss
bourbon-4.2.7 app/assets/stylesheets/addons/_position.scss
active_admin_pro-0.2.2 app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss
middleman-core-4.1.7 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss
codelation_assets-0.3.8 app/assets/stylesheets/bourbon/addons/_position.scss
codelation_assets-0.3.7 app/assets/stylesheets/bourbon/addons/_position.scss
middleman-core-4.1.6 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss
middleman-core-4.1.5 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss
middleman-core-4.1.3 fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss