p0c-website

Proof of concepts for fun and profit
git clone https://git.in0rdr.ch/p0c-website.git
Log | Files | Refs | Pull requests | README | LICENSE

_px-to-em.scss (366B)


      1 // Convert pixels to ems
      2 // eg. for a relational value of 12px write em(12) when the parent is 16px
      3 // if the parent is another value say 24px write em(12, 24)
      4 
      5 @function em($pxval, $base: $em-base) {
      6   @if not unitless($pxval) {
      7     $pxval: strip-units($pxval);
      8   }
      9   @if not unitless($base) {
     10     $base: strip-units($base);
     11   }
     12   @return ($pxval / $base) * 1em;
     13 }