SASS Size Shorthand
A Sass mixin to include the Size of an Element.
//**
// Mixin: size 
// Shorthand for insert Dimensions. Default in PX, opt in Percent
// Entering only one Value the Dimension Squared, with two Values
// the width and height are written.
//
// @mixin     size
// @param     $size {number} Width and or Height
// @usage     +size($size, $value)
// @eg        +size(200 100)
//**
@mixin size($size)
  @if length($size) == 2
    $width  : nth($size,1)
    $height : nth($size,2)
    @if unitless($width)
      $width: $width + 0px
    @if unitless($height)
      $height: $height + 0px
    height: $height
    width: $width
  @if length($size) == 1
    @if unitless($size)
      $size: $size + 0px
    height: $size
    width: $sizeWritten by sascha fuchs
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Sass 
Authors
Related Tags
#sass
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#