Kevin Powell - CommunityKP-C
Kevin Powell - Community15mo ago
126 replies
snxxwyy

px vs em/rem padding

Hey, i recently found out that using
px
for padding isn't necessarily a negative thing, especially if you don't want it to scale with text size. I also heard it shouldn't cause overflow but have found out otherwise, unless i'm doing something wrong? The first image is using em, the second is using
px
, and as you can see, the px causes the text to overflow. if i reduce the
px
value it somewhat fixes it however even if the value is larger i don't believe it should overflow?

I'd appreciate any insight since i'd like to be able to get out of using em/rem for a lot of things haha. Thanks in advance.

https://codepen.io/deerCabin/pen/mdNpbjZ
em.png
px.png
CodePenR
...
px vs em
Was this page helpful?