Previous Message
Next Message

Re: [css-d] CSS Browser Sniffer?

Sent by Andrew Clover on 27 January 2002 07:07

Karen J. Bowen [EMAIL-REMOVED]> wrote:

> This, I thought, was saying "give that font styling to all of the tags 
> listed"

> Is that correct?


> Or is there a better way to do this now?


To set the same font settings across all elements of the page it should
ideally be enough simply to set the font on 'body', and let it inherit
into all the document elements inside.

This doesn't happen in Netscape 4 because fonts don't inherit into or through
tables, so many people use a workaround like the selector you posted, to slap
font settings over more or less everything. It's a bit ugly but works,
except that you can't use 'em' or '%' font-size units. They're relative to
their parents, so by applying them across the board you are likely to get
nested font-sizes, which will cause confusion, especially where tables are
involved, since some browsers will inherit into tables and some not, argh.

The other browser that doesn't inherit font-size into <table> is IE/Win
(emulating one of Netscape's bugs!). Luckily you can turn this off by

  table { font-size: 1em; }

and then IE/Win will work the same as Op, Moz, Konq, IE/Mac etc., and you
can happily set a single font-size on 'body' and have it inherit
consistently on all but N4.

There are other workarounds if you need to use relative font sizes and
tables in N4, but they're not quite as clean.

Andrew Clover
Previous Message
Next Message

Message thread:

Possibly related: