Converting Units

@function convert-units()

Convert lengths between comparable units. You can also convert to browser-ems, relative to the browser default rather than the site root – useful for media queries.

Parameters & Return

$length: (length | string)

The length or named size to be converted.

$to-unit: (string)

The desired units to convert to. Some units (ch, vw, vh, vmin, vmax) cannot be converted.

$from-context: 'root' setting or 16px (length | string)

When converting from relative units, the absolute length (in px) to which $length refers - e.g. for $lengths in em units, would normally be the font-size of the current element.

$to-context: $from-context (length | string)

For converting to relative units, the absolute length in px to which the output value will refer. Defaults to the same as $from-context, since it is rarely needed.

@error

Context paremeters must resolve to a value in pixel units.

@error

Failed to convert #{$length} into #{$to-units}.

Requires

@function _ac-scale-get-size() [private]

@function _get-number() [private]

@function _get-px() [private]

$_BROWSER-DEFAULT-FONT-SIZE [private]

$sizes (map)

Used By

@function size()