Namespace: Util:to-em

Util:to-em

Source:

Methods

to-em($values, $base) → {Number|List.<Number>}

Convert one or more px values to (a) em value(s), based on a base font size in px, percent or rem. If the base is in % or rem, the base will be converted to px based on the global base font size.

Parameters:
Name Type Description
$values Number | List.<Number>

the value(s) to convert, usually px values, if a value is em, it will not be changed

$base Number

the base size to convert against

Source:
Returns:
the converted value(s)
Type
Number | List.<Number>
Example
to-em(32px, 16px)
  => 2em
to-em((10px, 20px, 40px), 20px)
  => [0.5em, 1em, 2em]