Last active
October 14, 2015 13:43
-
-
Save KnightAlex/6df9713fda629f11acb7 to your computer and use it in GitHub Desktop.
Font % resize trick
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
html { | |
font-size: 62.5%; | |
} | |
body { | |
font: 1.6em/1.4 'Roboto', sans-serif; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A popular technique to use throughout the document is to set the the font-size of the body to 62.5% (that is 62.5% of the default of 16px), which equates to 10px, or 0.625em. Now you can set the font-size for any elements using em units, with an easy-to-remember conversion, by dividing the px value by 10. This way 6px = 0.6em, 8px = 0.8em, 12px = 1.2em, 14px = 1.4em, 16px = 1.6em.