@function em($target, $context: $base-font-size) { @if $target == 0 { @return 0 } @return $target / $context + 0em; } $base-font-size: 15px; h1 { font-size: em(21px, 15px); // Outputs 1.4em }