Last active
August 29, 2015 14:11
-
-
Save thealscott/999dfae86a6c5a8ecc17 to your computer and use it in GitHub Desktop.
SASS mixin for REM based font sizing with a pixel value fallback for IE8
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
@mixin font-size($size, $modifier:1.6) { | |
/* For optimal use, adjust the default modifier value until it gives you the | |
same pixel value as the computed pixel value you get from using REMs. | |
If your root font-size is 100%, this will be 1.6 */ | |
// IE 8 fallback in pixels | |
$pixel-size: ($size * 10) * $modifier; | |
font-size: #{$pixel-size}px; | |
// fontsize in REM | |
font-size: #{$size}rem; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment