W3C home > Mailing lists > Public > www-style@w3.org > October 2009

Re: Inconsistent treatment of "em" and "ex" unit when used to specify "font-size"

From: Bert Bos <bert@w3.org>
Date: Fri, 30 Oct 2009 15:03:32 +0100
To: W3C Style List <www-style@w3.org>
Cc: Thomas Phinney <tphinney@cal.berkeley.edu>, Philip TAYLOR <P.Taylor@rhul.ac.uk>
Message-Id: <200910301503.33083.bert@w3.org>
On Monday 26 October 2009, Thomas Phinney wrote:
> I believe you are correct in your perception of a self-referential
> problem here.
>
> In the absence of an explicit x-height value, a value of 0.5 em would
> indeed be a reasonable default. (Note that this is not half the cap
> height: that value itself might average ~ 0.7 em; an aveage x-height
> might be about 0.7x the cap height.)

> On Mon, Oct 26, 2009 at 9:59 AM, Philip TAYLOR <P.Taylor@rhul.ac.uk> 
wrote:
> > Intrigued by the bug report from Ryan Foster [2], I read
> > the CSS 3 spec. on units, and read -- to my surprise -- the
> > following :
> >
> > em     the font size of the element (or,
> >       to the parent element's font size
> >       if set on the 'font-size' property)
> >
> > ex     the x-height of the element's font
> >
> > Is there any reason why "ex" does not also reference
> > the parent element's font size if set on the 'font-size'
> > property, as if "ex" units are used to specify font-size,
> > there would appear to be a problem of self-reference
> > (see example below).

The working group decided that this was an oversight and the ex 
definition will be changed to say the same as the em definition. We 
didn't check all implementations, but those we checked already do it 
this way. (Indeed, it would be hard to imagine how else it could work.)

> > --------
> > [1] The 'ex' unit is defined by the font's x-height.
> >    The x-height is so called because it is often equal
> >    to the height of the lowercase "x". However, an 'ex'
> >    is defined even for fonts that don't contain an "x".
> >    Should we say that ex is 0.5em if no better value exists?
> > --------

On that last sentence of the quoted text (which is marked as an issue in 
the working draft): The WG currently believes that the text of CSS 2.1 
("In the cases where it is impossible or impractical to determine the 
x-height, a value of 0.5em should be used.") is still the best and can 
be inserted unchanged at that point in the CSS3 module.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Friday, 30 October 2009 14:04:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:21 GMT