Skip to content

Instantly share code, notes, and snippets.

@andrewhathaway
Created March 20, 2013 13:00
Show Gist options
  • Save andrewhathaway/5204451 to your computer and use it in GitHub Desktop.
Save andrewhathaway/5204451 to your computer and use it in GitHub Desktop.
Sass function to work out EM's.
//Work out EM for font sizes etc.
// USAGE: font-size: em(12);
// USAGE: font-size: em(12, 16);
@function em($target, $parent: strip-units($body_base_font_size)) {
@return ($target / $parent) + em;
}
//Used for the EM function above - Removes units from a number
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment