Created
August 31, 2021 17:25
-
-
Save dougkeeling/061d7a26bb356963d8fc5b602d131c31 to your computer and use it in GitHub Desktop.
[Convert Font Size to Em] #scss #css
This file contains 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
$browser-context: 16; | |
@function em($pixels, $context: $browser-context) { | |
@if (unitless($pixels)) { | |
$pixels: $pixels * 1px; | |
} | |
@if (unitless($context)) { | |
$context: $context * 1px; | |
} | |
@return $pixels / $context * 1em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment