Created
October 11, 2022 19:15
-
-
Save connoro7/0e071e8f49be9e969dc1232c4d6838b2 to your computer and use it in GitHub Desktop.
Safely converts rem units from base-16 to base-10
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
/* Converts rem units from base-16 to base 10. */ | |
/* No more 76.5px / 16 = 4.78rem, or 25px / 16 = 1.56rem, or 2.2rem * 16 = 35.2px */ | |
/* 2.5rem becomes 25px */ | |
/* 7.65rem becomes 76.5px */ | |
:root { | |
/* Adjusts rem to base-10 equivalent */ | |
font-size: 62.5%; | |
} | |
body { | |
/* Adjusts *displayed* font size for accessibility, but rem remains in base-10 */ | |
font-size: 1.6rem; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment