Goldeneye Posted August 25, 2008 Share Posted August 25, 2008 Yeah, this is a really simple question. I've been doing CSS for quite a long time now and recently realized the (now) archaic ways of code. So in my stylesheets, I've used pixels as my preferred measurement since I first got into CSS. So what makes em better than using px? Should I change all of my measurements to em? I've heard some people recommend the em measurement in place of px. Quote Link to comment https://forums.phpfreaks.com/topic/121185-why-is-it-recommended-to-use-em-instead-of-px/ Share on other sites More sharing options...
haku Posted August 25, 2008 Share Posted August 25, 2008 There isn't an absolute to this. In some situations ems are better, and in some situations, pixels are better. Ems are dynamic, so if you increase your text size then anything sized in ems will also expand. Pixels are fixed so they will stay the same regardless of text size. I prefer pixels for margins and padding, as they usually don't need to increase in size as the text size increases. Quote Link to comment https://forums.phpfreaks.com/topic/121185-why-is-it-recommended-to-use-em-instead-of-px/#findComment-624756 Share on other sites More sharing options...
bronzemonkey Posted August 25, 2008 Share Posted August 25, 2008 You should always use em or percentages for font-size otherwise IE users will not be able to resize text. Using em/px/% for anything else depends on the layout you are trying to construct. Quote Link to comment https://forums.phpfreaks.com/topic/121185-why-is-it-recommended-to-use-em-instead-of-px/#findComment-624950 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.