Created
March 12, 2015 23:55
-
-
Save jasonkmccoy/1ddf7ac9a7dc0014b35f to your computer and use it in GitHub Desktop.
Set a rem font size with pixel fallback (using a function and a mixin) http://zerosixthree.se/8-sass-mixins-you-must-have-in-your-toolbox/
This file contains hidden or 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
p { | |
font-size: 14px; //Will be overridden if browser supports rem | |
font-size: 0.8rem; | |
} |
This file contains hidden or 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
p { | |
@include font-size(14px) | |
} |
This file contains hidden or 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 calculateRem($size) { | |
$remSize: $size / 16px; | |
@return $remSize * 1rem; | |
} | |
@mixin font-size($size) { | |
font-size: $size; | |
font-size: calculateRem($size); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment