Thanks Nikola! No matter which of the three methods you prefer, I would suggest two improvements.
// Add unit to value font-size: 1 + rem + 1rem; // → string '1rem1rem' // Convert unit font-size: 1 * 1rem + 1rem; // → 2rem
math.div
/
@use 'sass:math'; @function pxToRem($pxValue) { @return math.div($pxValue, 16px) * 1rem; } div { width: pxToRem(400px); // → 25rem }
Amazing, it's fully supported!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks Nikola! No matter which of the three methods you prefer, I would suggest two improvements.
math.div
for division instead of/
operator as using/
for division is deprecated and will be removed in Dart Sass 2.0.0.Amazing, it's fully supported!