Created
January 21, 2014 08:22
-
-
Save SteAllan/8536220 to your computer and use it in GitHub Desktop.
A Sass function to convert px values into rems, based on the px to em function in Bourbon (http://bourbon.io/docs/#px-to-em)
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
// Convert a px value into a rem value. | |
// Supply the rem value to the primary style sheet and the px fallback to the ltie9 style sheet. | |
@function rem($pxval) { | |
$val: strip-unit($pxval); | |
$base: strip-unit($browser-default-font-size); | |
@if ($ltie9 == true) { | |
@return $val * 1px; | |
} | |
@else { | |
@return ($val / $base) * 1rem; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment