Re: Proper font-size calculation with ems

Hi BK. This kind of thing is probably better hunted down in one of the
CSS-specific sites.

The basic idea is that you do something like

/* the basic element has a different size */
span, li { font-size:1.1em }

/* but when it is an element that already has a changed size, don't change
it any more.
   Note that you need to collect the combinations you might have set. */

span > span, span > li, li > span, li > li { font-size:100%}

I think the common W3C stylesheets do this (ones that are applied to specs
and stuff).

cheers

Chaals

-- 
Charles McCathieNevile           charles@sidar.org
                 http://www.sidar.org

<quote who="B.K. DeLong">

>>Indeed, .76em normally renders as 12px, and not 11px as I said.
>
> I would love to take all our font sizes in
> http://ocw.mit.edu/OcwWeb/style/core.css
>
> and convert them to ems. The problem I run into is inheritance and
> nesting.
> Often times out WYSIWYG editor in our CMS will nest several bodycopy
> <span>
> elements and just make the font size smaller and smaller, were it ems. I'd
> love to figure out how to keep that from happening.

Received on Friday, 7 January 2005 06:20:26 UTC