Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: Best way to specify font size

Roy Schestowitz wrote:
> __/ [Els] on Monday 12 December 2005 07:27 \__
>> Roy Schestowitz wrote:
>>> __/ [Els] on Sunday 11 December 2005 18:54 \__
>>>> JD wrote:
>>>> 
>>>>> What's the best way to specify font size using CSS? I try to avoid
>>>>> absolute units like pt and px because then users can't resize the fonts
>>>>> in IE, but % and em are a complete pain to use IMO. I read somewhere (a
>>>>> W3C tip I think) that the best way is to specify a "base" size and then
>>>>> have all your fonts relative that, but I'm not sure how that works.
>>>> 
>>>> What's the pain in using %?
>>>> Just set 100% for <body> (the "base" size), and then use other
>>>> percentages like 85% for small print and 120% for headings, etc.
>>>> Those are indeed relative to the percentage set for the <body>.
>>> 
>>> Overall, this probably depends on the page in question. There are cases
>>> where the font size should be relative to the screen/window size. In such
>>> circumstances, 'em' should be used. It takes an example to give a proper
>>> answer, in my humble opinion.
>> 
>> It also takes an example to explain how 'em' is relative to
>> screen/window size and % isn't.
> 
> I believe that this argument will be meaningless to development which is
> Internet Explorer-centric:
> 
> http://archivist.incutio.com/viewlist/css-discuss/1439

That's about sizes for elements other than font.
Yes, if I want a box to scale with the text inside, I use em, as it's
relative to the font-size, while percentage is relative to the
viewport or parent element. (I never saw a difference between IE and
the other browsers in that btw - maybe something in Quirksmode?)

I still don't see how em is relative to screensize really.
A font-size of 1em is equal to a font-size of 100% afaik.
IE has a scaling problem if the font-size for <body> isn't set in
percentages, but other than that, I see no difference.
 
> As far as I can gather, em gives a great deal of power. I have just tried
> some pages of mine under Opera (which I know you advocate) to reveal some
> unpleasant interpretations of the source. Overall, Opera at its present
> seems excellent so I am glad I took your word.

I advocate Opera? 
Hmm.. might have done by accident some time... ;-)
I use Opera and Firefox, and I still prefer Firefox, although I'm
starting to use Opera more and more for surfing. Not because I think
it's a better browser, but because I like to keep more than one
browser open, so it's easier to differentiate between work-tabs and
surf-tabs.

-- 
Els                     http://locusmeus.com/
Sonhos vem. Sonhos vÃo. O resto à imperfeito.
                             - Renato Russo -
Now playing: The Cult - She Sells Sanctuary (Long Version)

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index