Created
March 28, 2022 16:16
-
-
Save heanfig/a55ca7934556da2400e979291aeb0b31 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
@function length($number, $unit) { | |
$strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax'; | |
$units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax; | |
$index: index($strings, $unit); | |
@if not $index { | |
@warn "Unknown unit `#{$unit}`."; | |
@return false; | |
} | |
@return $number * nth($units, $index); | |
} | |
@function calculateRem($size) { | |
$parentSize : 23px; | |
$remSize: $size / $parentSize; | |
@return length($remSize,'rem'); | |
} | |
body { | |
width: (calculateRem(16px) - calculateRem(23px) / 5rem); | |
} |
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
body { | |
width: 0.4956521739rem; | |
} |
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
{ | |
"sass": { | |
"compiler": "dart-sass/1.32.12", | |
"extensions": {}, | |
"syntax": "SCSS", | |
"outputStyle": "expanded" | |
}, | |
"autoprefixer": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment