Skip to content

Instantly share code, notes, and snippets.

@dominykas
Created November 15, 2012 08:49
Show Gist options
  • Save dominykas/4077473 to your computer and use it in GitHub Desktop.
Save dominykas/4077473 to your computer and use it in GitHub Desktop.
Function to use rem units, unless forced to use pixels

In IE specific stylesheet set $rem-to-px: 16px; and then in your ordinary stylesheets use rem(X) - this will produce Xrem for normal browsers and (X*16)px for IEold.

See also: http://jakearchibald.github.com/sass-ie/

$rem-to-px: false !default;
@function rem($val) {
@if $rem-to-px {
@return $val*$rem-to-px;
} @else {
@return $val*1rem;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment