Does using em
as css unit solve the problem in difference in monitor resolution (800x600 vs. 1024x768)?
views:
76answers:
2
A:
Yes, em
sets the css targets size relative to the pre-calculated em block
of the parent. See wikipedia for more info on what an Em is.
Basically, as the resolution goes up, the computed size of an Em goes up to. The size of the Em block is a function of the resolution, and the users-preference (font-size) -- so you get the best of both worlds.
This is why W3C suggests using Em for fluid displays.
Evan Carroll
2010-02-02 06:26:11
“The size of the Em block is a function of the resolution, and the users-preference (font-size)” — really? I thought it was just a function of the font-size. How does resolution affect it?
Paul D. Waite
2010-02-02 06:28:53
No, afaik, the Em block *is* the font-size. However, it isn't such that it is set to a constant in pixels; instead, it is a function of resolution/dpi and user-agent-settings.. I could be wrong, it could be a function of dpi+user-agent where DPI is a function of resolution or statically set. I'm not a font guy, and I think many of these points extend outside of the question. Enlighten me if I'm wrong though, and I'll withdraw the answer ;)
Evan Carroll
2010-02-02 07:23:51
A:
If by "solving the problem in difference in monitor resolution" you mean making it scale like a vector image, then no. An em is a unit of measurement that scales depending on the font size the user has selected (for me using default settings, 1 em is equal to 16 pt font), and doesn't scale depending on the user's screen resolution.
Peeps
2010-02-15 03:19:31