unit

unit($number)

Returns the unit(s) associated with a number. Complex units are sorted in alphabetical order by numerator and denominator.

Examples:

unit(100) => ""
unit(100px) => "px"
unit(3em) => "em"
unit(10px * 5em) => "em*px"
unit(10px * 5em / 30cm / 1rem) => "em*px/cm*rem"

Parameters:

  • $number (Number)

Returns:

  • (String) The unit(s) of the number, as a quoted string

Raises:

  • (ArgumentError) if $number isn’t a number
doc_Sass
2016-11-11 13:09:28
Comments
Leave a Comment

Please login to continue.