Skip to content

Instantly share code, notes, and snippets.

@GerardKetuma
Forked from ijy/Compass px to em
Last active June 19, 2019 00:31
Show Gist options
  • Save GerardKetuma/5574637 to your computer and use it in GitHub Desktop.
Save GerardKetuma/5574637 to your computer and use it in GitHub Desktop.
@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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment