Skip to content

Instantly share code, notes, and snippets.

@JoeNoPhoto
Created October 14, 2015 07:01
Show Gist options
  • Save JoeNoPhoto/27e43fee032628a299dd to your computer and use it in GitHub Desktop.
Save JoeNoPhoto/27e43fee032628a299dd to your computer and use it in GitHub Desktop.
rem font size with pixel fallback
@function calculateRem($size) {
$remSize: $size / 16px;
@return $remSize * 1rem;
}
@mixin font-size($size) {
font-size: $size;
font-size: calculateRem($size);
}
@JoeNoPhoto
Copy link
Author

Usage

p {
  @include font-size(14px)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment