Last active
April 17, 2018 22:07
-
-
Save dantman/841b85ab34ea6af93ac2 to your computer and use it in GitHub Desktop.
Material Design sp units (px unit that scale to the user's font settings) using rems
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
html { | |
font-size: 14px; | |
} | |
/** | |
* PostCSS | |
* Use a custom PostCSS to convert #sp to rems by dividing the number by 14 and expressing it as #rem | |
*/ | |
body { | |
/* Device */ font-size: 14sp; /* -> 1rem */ | |
/* Desktop */ font-size: 13sp; /* -> 0.92857rem */ | |
} | |
/** SASS */ | |
@function sp($sp) { | |
@return ($sp / 14) * 1rem; | |
} | |
body { | |
/* Device */ font-size: sp(14); | |
/* Desktop */ font-size: sp(13); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment