DEV Community

Discussion on: Are You Bored Of Converting "px" to "em" Using A Calculator, SASS Will Solve The Problem

Collapse
 
fjones profile image
FJones

em [...] is equal to 16px

What? No. 1rem is usually equal to 16px, because that's the common default value for root level font-size, but that's neither the value of 1em, nor in any way a value you should just assume. As soon as you get any nested font-size declarations, this method falls apart very quickly, and unless you apply it extremely consistently (or force a root font size), scaling gets thrown off a bit by this.

Don't calculate em based on px values! Familiarize yourself with how font-size works, and consider specifically what you want to achieve: Do you want your type to scale with the user's (or container's) font-size, or do you simply want to avoid using px values "because that's best practice"?

Collapse
 
ayabouchiha profile image
Aya Bouchiha

Thank you for the feedback 🙏🏻