Skip to content Skip to sidebar Skip to footer

Html: How Common Is It That Different Browsers Render 1em At A Different Actual Px Size?

As you know, you can specify dimensions with CSS in px or em. As far as I understand it, em means 'line height of the current element's fonts'. My approach currently is to always u

Solution 1:

No. ems are relative to the user's chosen font size, px aren't. The default font sizes of desktop browsers are about the same in pixels, but mobile devices in particular will vary even before user adjustment.

You should use em for a margin in text content that should be sized similarly to the surrounding fonts, and px for a margin that has to line up with images used by the page layout.

Solution 2:

No, you cannot.

The size of em in pixels is related to the font type & size you're using, the resolution of your screen (depending on OS, browser), and possible further OS and browser settings - eg "Show fonts +10%" may alter the em value.

Post a Comment for "Html: How Common Is It That Different Browsers Render 1em At A Different Actual Px Size?"