Skip to content

Instantly share code, notes, and snippets.

@klongdesigns
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klongdesigns/b02c7ab5630781947302 to your computer and use it in GitHub Desktop.
Save klongdesigns/b02c7ab5630781947302 to your computer and use it in GitHub Desktop.
Less file for setting font sizes in rem
//mixin declaration
.font-size(@sizeValue) {
@remValue: @sizeValue;
@pxValue: @sizeValue;
font-size: ~"@{pxValue}px";
font-size: ~"@{remValue}rem";
}
//media queries set
font-size: .9px;
/* Small devices (tablets, 768px and up) */
@media (min-width: @screen-sm-min) {
html {
font-size: .8px;
}
}
/* Medium devices (desktops, 992px and up) */
@media (min-width: @screen-md-min) {
html {
font-size: 1px;
}
}
/* Large devices (large desktops, 1200px and up) */
@media (min-width: @screen-lg-min) {
}
This of course assumes you are using font-size = 1px.
@mixin font-size($sizeValue) {
font-size: ($sizeValue) + px;
font-size: $sizeValue + rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment