Created
August 11, 2013 09:19
-
-
Save gisu/6204136 to your computer and use it in GitHub Desktop.
Shorthand Mixin to include the Size (width and/or height)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//** | |
// 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: $size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment