Last Updated: February 25, 2016
·
484
· kachunchau

Px to em and Px to rem sizing

// Base font size in px
$base-font-size: 16;

// Px to em sizing 
@function calc-em($size, $context: $base-font-size) {
     @return ($size / $context) + em;
}

// Px to rem sizing with px fallout
@mixin font-size($size) {
  font-size: $size + px;
  font-size: ($size / $base-font-size) + rem;
}