Skip to content

Instantly share code, notes, and snippets.

@artlili
Last active May 31, 2019 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artlili/d5b74008367837e4c3f4b2ca095637da to your computer and use it in GitHub Desktop.
Save artlili/d5b74008367837e4c3f4b2ca095637da to your computer and use it in GitHub Desktop.
px to rem
@function rem($pixels, $context: $base-font-size) {
@if (unitless($pixels)) {
$pixels: $pixels * 1px;
}
@if (unitless($context)) {
$context: $context * 1px;
}
@return $pixels / $context * 1rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment