Skip to content

Instantly share code, notes, and snippets.

@pospi
Last active December 23, 2015 18:59
Show Gist options
  • Save pospi/6679163 to your computer and use it in GitHub Desktop.
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.
@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%;
}
$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