Last Updated: February 25, 2016
·
1.262K
· paullonorato

Convert PX to EM using SASS preprocessor

Create a function

@function convert-px-em( $value , $context: 16 ){
    @return #{ $value / $context + 'em' };
}

how to use

.my-class{
    font-size: convert-px-em( 28 );
}