Created
October 18, 2012 17:28
-
-
Save weblancaster/3913519 to your computer and use it in GitHub Desktop.
Function to transform px to em using SASS
This file contains 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
// formula/function to transform px to em. | |
@function calc-em($target-px, $context) { | |
@return ($target-px / $context) * 1em; | |
} | |
//use like this | |
selector { | |
padding-left: calc-em(20px, 16px); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment