summaryrefslogtreecommitdiff
path: root/_sass/bourbon/functions/_px-to-em.scss
blob: ae81a44ada76293bcfb74305521bbf00f61dd446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Convert pixels to ems
// eg. for a relational value of 12px write em(12) when the parent is 16px
// if the parent is another value say 24px write em(12, 24)

@function em($pxval, $base: $em-base) {
  @if not unitless($pxval) {
    $pxval: strip-units($pxval);
  }
  @if not unitless($base) {
    $base: strip-units($base);
  }
  @return ($pxval / $base) * 1em;
}