Skip to content

Instantly share code, notes, and snippets.

@BronsonQuick
Created January 3, 2014 06:08
Show Gist options
  • Save BronsonQuick/8233624 to your computer and use it in GitHub Desktop.
Save BronsonQuick/8233624 to your computer and use it in GitHub Desktop.
A Sass mixin for rems & a pixel fallback for < IE8 and Opera Mini
/* Set up a variable for maths */
$doc-font-size: 16;
/* the font-size mixin */
@mixin font-size($size) {
font-size: 0px + $size;
font-size: 0rem + $size / $doc-font-size;
}
/* example of usage */
h3 {
@include font-size(16);
}
/* example compiled */
h3 {
font-size: 16px;
font-size: 1rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment