Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SASS mixin for Pixels to EM
// ----
// 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);
}
Undefined variable: "$em-base".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.