Slide 40
Slide 40 text
@onishiweb
@onishiweb
@mixin rem($property, $px-values, $baseline-px: $base-font-size) {
// Convert the baseline into rems
$baseline-rem: $baseline-px / 1rem;
// Create an empty list that we can dump values into
$rem-values: ();
@each $value in $px-values {
// If the value is zero, return 0
$rem-values: append($rem-values, if($value == 0, $value, $value /
$baseline-rem));
}
// Output the property's px and rem values
#{$property}: $px-values;
#{$property}: $rem-values;
}
Ben Scott REM mixin: http://bit.ly/1ka4FYT