Last Updated: February 25, 2016
·
2.081K
· kimgoulb

Simple SASS Em Calculator Function

// DEFAULTS (define the default em value in pixels)
$emBase: 16px; //default

// FUNCTION (em calculator)
@function emCal($pixelBasedNum){
  @return $pixelBasedNum / $emBase * 1em
}

// IN USE
.container {
  width: emCal(1200px); // will return 75em
}