saqib (AT) stonebeat (DOT) org (Saqib Ali) wrote:
Quote:
I was told that I should always use "%" in defining font sizes. In
what scenario should the "em/ex/px" be used? |
em (and ex) are in theory just as good as % but in practice they
trigger a few more browser bugs, so % is preferred for font-size. Use
em for scalable derived styles (such as padding). ex is further
screwed on several platforms where it is just treated as 0.5em rather
than as the correct value for the font in question.
px is treated as screen pixels in all current browsers (despite the
CSS defining it quite differently). Use it just for items that are
naturally pixel sized (bitmap images and the like) and for styles that
are _directly_ related to such items. I must admit that I frequenly
break this rule and define borders in px sizes - despite the fact that
I know that for some users (poor vision or high res displays) my
borders will be impossible to see.
The physical units (in, pt, pica, cm, mm) are only useful when you
know the dimensions of the output medium. On the www this is virtually
never the case. Even print stylesheets may be applied to print outs on
different sized papers.
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor
Steve Pugh <steve (AT) pugh (DOT) net> <http://steve.pugh.net/>