Re: Font sizes - Best practice... px vs. em
"Barry Pearson" <news@childsupp ortanalysis.co. uk> wrote:
[color=blue]
>I've been confused by the following page:
>http://msdn.microsoft.com/library/de...rties/font.asp
>
>It is talking about the "font" property in CSS. (I use such a DOCTYPE):
>
>"As of Internet Explorer 6, when you use the !DOCTYPE declaration to specify
>standards-compliant mode, the following conditions apply to this property. The
>font-size and font-family values must be declared. If font-size and
>font-family are not declared, or are not in the correct order, the font
>property is ignored. All specified values must appear in the correct order.
>Otherwise, the font property is ignored. In standards-compliant mode, the
>default font-size is small, not medium. If not explicitly set, font-size
>returns a point value".[/color]
That is rather badly written isn't it?
[color=blue]
>That last bit was a puzzle - it appears to say the IE 6 is not obeying the CSS
>specificatio n properly. Or it may mean something else entirely! It has led me
>to specify "medium" in the body rule. I get the expected results in the
>browsers I use, but I haven't a clue what it does to other cases "out there".[/color]
If you set font-size: medium; in your CSS then you would expect this
to appear at the user's/browser's default font size, wouldn't you?
Not if you work for MS!
IE, up to version 5.5 assumed that the browser's default was what
should appear if you set font-size: small.
In IE6 doctype sniffing means that font-size: medium may be the
browser default size (if standards mode s triggered) or may be larger
than the default size (if quirks mode is triggered).
(NB, the CSS font-size: small, medium, etc., has nothing to do with
the IE font sizing, smallest, smaller, medium, etc. Whichever size is
set in the IE preferences is the browser default and hence becomes CSS
small/medium)
Opera also complicates matters. It used to get it right, then it got
it wrong and now it sniffs doctypes.
[color=blue]
>Is there actually a consensus on best practice for font properties in the body
>rule? If there is, what are the implications for all those web sites?[/color]
If you set a font size for body then set it at either 100% or 1em (or
maybe at 101% to cope with an Opera 5/6 bug). 100% is preferred as it
avoids an IE bug when the default size in the browser is set to
anything other than Medium.
Of the other font properties, it would be rare to set font-weight,
font-style or font-variant on body. Setting font-family is common and
the only advice is to avoid fonts like Verdana that _appear_ to be
very different in size to the 'average'.
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@pugh.net > <http://steve.pugh.net/>
"Barry Pearson" <news@childsupp ortanalysis.co. uk> wrote:
[color=blue]
>I've been confused by the following page:
>http://msdn.microsoft.com/library/de...rties/font.asp
>
>It is talking about the "font" property in CSS. (I use such a DOCTYPE):
>
>"As of Internet Explorer 6, when you use the !DOCTYPE declaration to specify
>standards-compliant mode, the following conditions apply to this property. The
>font-size and font-family values must be declared. If font-size and
>font-family are not declared, or are not in the correct order, the font
>property is ignored. All specified values must appear in the correct order.
>Otherwise, the font property is ignored. In standards-compliant mode, the
>default font-size is small, not medium. If not explicitly set, font-size
>returns a point value".[/color]
That is rather badly written isn't it?
[color=blue]
>That last bit was a puzzle - it appears to say the IE 6 is not obeying the CSS
>specificatio n properly. Or it may mean something else entirely! It has led me
>to specify "medium" in the body rule. I get the expected results in the
>browsers I use, but I haven't a clue what it does to other cases "out there".[/color]
If you set font-size: medium; in your CSS then you would expect this
to appear at the user's/browser's default font size, wouldn't you?
Not if you work for MS!
IE, up to version 5.5 assumed that the browser's default was what
should appear if you set font-size: small.
In IE6 doctype sniffing means that font-size: medium may be the
browser default size (if standards mode s triggered) or may be larger
than the default size (if quirks mode is triggered).
(NB, the CSS font-size: small, medium, etc., has nothing to do with
the IE font sizing, smallest, smaller, medium, etc. Whichever size is
set in the IE preferences is the browser default and hence becomes CSS
small/medium)
Opera also complicates matters. It used to get it right, then it got
it wrong and now it sniffs doctypes.
[color=blue]
>Is there actually a consensus on best practice for font properties in the body
>rule? If there is, what are the implications for all those web sites?[/color]
If you set a font size for body then set it at either 100% or 1em (or
maybe at 101% to cope with an Opera 5/6 bug). 100% is preferred as it
avoids an IE bug when the default size in the browser is set to
anything other than Medium.
Of the other font properties, it would be rare to set font-weight,
font-style or font-variant on body. Setting font-family is common and
the only advice is to avoid fonts like Verdana that _appear_ to be
very different in size to the 'average'.
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@pugh.net > <http://steve.pugh.net/>
Comment