Skip to content

Instantly share code, notes, and snippets.

@avclark
Created December 4, 2013 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avclark/7780962 to your computer and use it in GitHub Desktop.
Save avclark/7780962 to your computer and use it in GitHub Desktop.
@mixin rem( $property, $a:0, $b:$a, $c:$a, $d:$b ) {
@if ( $property == "font-size" ) {
// $a is the font size
// %b is the keyword
@if ( $a != $b ) {
font-size: $b;
}
@else {
font-size: $a * $base-font-multiplier * 16px;
}
font-size: $a * 1rem;
} @else {
$apx: $a * $base-font-multiplier * 16px;
$bpx: $b * $base-font-multiplier * 16px;
$cpx: $c * $base-font-multiplier * 16px;
$dpx: $d * $base-font-multiplier * 16px;
$arem: $a * 1rem;
$brem: $b * 1rem;
$crem: $c * 1rem;
$drem: $d * 1rem;
@if ( $property == "padding" or $property == "margin" ){
#{$property}: $apx $bpx $cpx $dpx;
#{$property}: $arem $brem $crem $drem;
} @else {
#{$property}: $apx;
#{$property}: $arem;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment