Last active
December 23, 2015 18:59
-
-
Save pospi/6679163 to your computer and use it in GitHub Desktop.
Setup base font size reliably with CSS. Creates any baseline font size you wish to base your em units off.
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
@BASE_FONT_SIZE = 16; | |
@BASE_LINE_HEIGHT = 1.5; | |
// consistent base font size & line height (16px) | |
html { | |
font-size: 100%; | |
*font-size: 16px; | |
line-height: @BASE_LINE_HEIGHT; | |
} | |
// set your base font size by dividing desired font pixel size by 16 | |
body { | |
font-size: (@BASE_FONT_SIZE / 16) * 100%; | |
} |
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
$BASE_FONT_SIZE : 16; | |
$BASE_LINE_HEIGHT : 1.5; | |
// consistent base font size & line height (16px) | |
html { | |
font-size: 100%; | |
*font-size: 16px; | |
line-height: $BASE_LINE_HEIGHT; | |
} | |
// set your base font size by dividing desired font pixel size by 16 | |
body { | |
font-size: ($BASE_FONT_SIZE / 16) * 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment