Created
March 7, 2014 22:40
-
-
Save leongaban/9421693 to your computer and use it in GitHub Desktop.
SASS mixin for Pixels to EM
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
// ---- | |
// Sass (v3.3.0.rc.5) | |
// Compass (v1.0.0.alpha.18) | |
// ---- | |
/* PIXELS to EM */ | |
// eg. for a relational value of 12px write em(12) when the parent is 16px | |
// if the parent is another value say 24px write em(12, 24) | |
// @include em(12); | |
@function em($pxval, $base: $em-base) { | |
@if not unitless($pxval) { | |
$pxval: strip-units($pxval); | |
} | |
@if not unitless($base) { | |
$base: strip-units($base); | |
} | |
@return ($pxval / $base) * 1em; | |
} | |
// widget table headers | |
section header h1 { | |
font-family: LatoRegular; | |
font-size: em(18); | |
} |
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
Undefined variable: "$em-base". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment