Created
December 5, 2024 13:05
-
-
Save SubZane/4247ef8c7a2004b897a3c2a5452dbffa to your computer and use it in GitHub Desktop.
px to rem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@use 'sass:math'; | |
$base-font-size = 16px | |
@function stripUnit($value) { | |
@return $value / ($value * 0 + 1); | |
} | |
@function rem($pxValue) { | |
@return #{math.div(stripUnit($pxValue), stripUnit($base-font-size)}rem; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment