Sass unit() Function

Last Updated:

Sass unit() Function

The unit() function returns a string representation of a number's units.

Example

SASS TO CSS CONVERTER
//Check your console @debug unit(50); // "" @debug unit(50px); // "px" @debug unit(2px * 4px); // "px*px" @debug unit(10px / 5s); // "px/s"

Syntax

unit($x)

Parameter Value

ValueTypeExplanation
$x Required A number (with or without unit).

Return Value

ValueExplanation
Number Returns a string representation of $x's units.

Share this Page

Meet the Author