Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sass px to em mixin
// http://viljamis.com/blog/2013/prototyping-responsive-typography/?utm_source=Responsive+Design+Weekly&utm_campaign=76e7785581-Responsive_Design_Weekly_046&utm_medium=email
$browser-context: 16; // Default
@function em($pixels, $context: $browser-context) {
@return #{$pixels/$context}em
}
body {
font-size: em(16);
}
p.intro {
font-size: em(24);
}
h1 {
font-size: em(72);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment