Skip to content

Instantly share code, notes, and snippets.

@thealscott
Last active August 29, 2015 14:11
Show Gist options
  • Save thealscott/999dfae86a6c5a8ecc17 to your computer and use it in GitHub Desktop.
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
@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