Skip to content

Instantly share code, notes, and snippets.

@jnowland
Last active March 30, 2016 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnowland/0be008d53cc0399f6be7ed3a24ace6e6 to your computer and use it in GitHub Desktop.
Save jnowland/0be008d53cc0399f6be7ed3a24ace6e6 to your computer and use it in GitHub Desktop.
Using EM's
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}
@function em($target, $context: $base-font-size, $unitless: false) {
@if ($unitless == false) {
@return ($target / $context) * 1em;
}
@else {
@return strip-units(($target / $context));
}
}
$base-font: 16px;
$card-title-font-size: 18px;
$card-meta-font-size: 13px;
body {
font-size: $base-font;
}
.Card {
font-size: em($card-title-font-size, $base-font);
}
.Card-meta {
font-size: em($card-meta-font-size, $card-title-font-size);
line-height: em(21px, $card-meta-font-size, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment