px-Werte nach em Konvertieren

////
/// Calculate em for given pixel $values based on $context font-size
///
/// @param   {List}    $values       To be converted pixel values
/// @param   {Number}  [$context]    Font-size for em calculation
////
@function calc-em($values, $context: $font-size-default) {
    $result: ();

    @each $value in $values {
        $result: append($result, 0em + ($value / $context));
    }

    @return $result;
}

Einheit entfernen

////
/// Remove the unit of a length
///
/// @param {Number} $number - Number to remove unit from
/// @return {Number} - Unitless number
////
@function strip-unit($number) {
    @if type-of($number) == 'number' and not unitless($number) {
        @return $number / ($number * 0 + 1);
    }

    @return $number;
}

 

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht.