Skip to content

Instantly share code, notes, and snippets.

@jdeagle
Forked from ijy/Compass px to em
Created September 24, 2013 01:28
Show Gist options
  • Save jdeagle/6679237 to your computer and use it in GitHub Desktop.
Save jdeagle/6679237 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