Created
April 17, 2013 18:22
-
-
Save fstorr/5406527 to your computer and use it in GitHub Desktop.
SASS functions for px to em and em 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
| $eminpx:14; | |
| @function pxtoem($target, $context:$eminpx){ | |
| @return #{$target/$context}em; | |
| } | |
| @function emtopx($target, $context:$eminpx){ | |
| @return #{$target*$context}px; | |
| } | |
| /* this can take one or two arguments: | |
| margin-bottom: pxtoem(10); // this will use the $eminpx variable as the second value | |
| margin-bottom: pxtoem(10,18); | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment