I'm a indie software developer. That means I'm running solo. I create WordPress/WooCommerce plugins and some Android apps. Hope to learn more from awesome people here on dev.to
It's a common practice to use rem for font size and em for padding and margin. For border, use px.
The reason (to use em for padding and margin) is as em based on font size of the element, when you change the font size, the margin and padding will reflect that change.
In the case of font size, using rem make it more predictable since it is based on the root element only, not parent's size like while using em.
I'm a indie software developer. That means I'm running solo. I create WordPress/WooCommerce plugins and some Android apps. Hope to learn more from awesome people here on dev.to
It's a common practice to use rem for font size and em for padding and margin. For border, use px.
The reason (to use em for padding and margin) is as em based on font size of the element, when you change the font size, the margin and padding will reflect that change.
In the case of font size, using rem make it more predictable since it is based on the root element only, not parent's size like while using em.
Ahh that makes sense. Thank you for clarifying!
My pleasure. I'm glad it helps :)