Skip to content

Instantly share code, notes, and snippets.

@chrisblackwell
Created January 24, 2014 15:55
Show Gist options
  • Save chrisblackwell/8600042 to your computer and use it in GitHub Desktop.
Save chrisblackwell/8600042 to your computer and use it in GitHub Desktop.
Mixin to convert REM to px
/* Set up a variable for maths */
$doc-font-size: 16;
/* the font-size mixin */
@mixin font-size($size) {
font-size: 0px + $size;
font-size: 0rem + $size / $doc-font-size;
}
/* example of usage */
.prose p {
@include font-size(16);
}
/* example compiled */
.prose p {
font-size: 16px;
font-size: 1rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment