Last active
March 30, 2016 23:43
-
-
Save jnowland/0be008d53cc0399f6be7ed3a24ace6e6 to your computer and use it in GitHub Desktop.
Using EM's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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