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"?
What? No.
1rem
is usually equal to16px
, because that's the common default value for root levelfont-size
, but that's neither the value of1em
, nor in any way a value you should just assume. As soon as you get any nestedfont-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 onpx
values! Familiarize yourself with howfont-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 usingpx
values "because that's best practice"?Thank you for the feedback 🙏🏻