Skip to content

Instantly share code, notes, and snippets.

@ngryman
Created March 3, 2013 19:03
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save ngryman/5077672 to your computer and use it in GitHub Desktop.
Save ngryman/5077672 to your computer and use it in GitHub Desktop.
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