Created
January 24, 2014 15:55
-
-
Save chrisblackwell/8600042 to your computer and use it in GitHub Desktop.
Mixin to convert REM to px
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
/* 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