mirror of
https://github.com/scratchfoundation/scratchx.git
synced 2024-11-29 02:55:53 -05:00
16 lines
336 B
SCSS
16 lines
336 B
SCSS
|
// Convert pixels to rems
|
||
|
// eg. for a relational value of 12px write rem(12)
|
||
|
// Assumes $em-base is the font-size of <html>
|
||
|
|
||
|
@function rem($pxval) {
|
||
|
@if not unitless($pxval) {
|
||
|
$pxval: strip-units($pxval);
|
||
|
}
|
||
|
|
||
|
$base: $em-base;
|
||
|
@if not unitless($base) {
|
||
|
$base: strip-units($base);
|
||
|
}
|
||
|
@return ($pxval / $base) * 1rem;
|
||
|
}
|