From: C A Upsdell on
dorayme wrote:
> In article <hbgrdb$ksa$1(a)news.eternal-september.org>,
> C A Upsdell <cupsdell(a)nospam.not> wrote:
>
>> dorayme wrote:
>>>> There is a view that ex units should be used instead of em units. I
>>>> have recently found that using ex instead of em fixed some cross-browser
>>>> issues. See:
>>>>
>>>> http://kb.mozillazine.org/Em_units_versus_ex_units
>>> It is all precious nonsense. It does not matter about small variations
>>> and if it concerns anyone, they are obsessing about the wrong things.
>> What I was "obsessing about", which I solved by switching a particular
>> dimension from em to ex units, was a problem with a CSS-based dropdown
>> menu: with Opera, when the user pointed to a menu item, then moved the
>> cursor down to the associated dropdown menu, the dropdown menu sometimes
>> disappeared. IMO such a problem in a website is not unimportant.
>
> I agree that in the area of dropdown menus, one sometimes needs all the
> help one can get, they can be tricky beasts and it cannot hurt to keep
> in mind your thought to use ex if one runs into cross browser problems.
>
> But without a specific case, it is hard to know in advance. One of the
> things you tend to run into in dropdown menus is wrap and height
> problems and using the ex might simply be a more reliable way just for
> these problems. I have no idea how it might affect or generate other
> problems though?

I will both strengthen and weaken my suspicions:

1. Applying the same solution -- actually a refinement of my original
solution, using only multiples of 0.5ex units for dimensions -- fixed a
perplexing problem in another site's dropdown menu: the menu worked,
but there were visual anomalies with some browsers, and applying the
refined solution *completely* eliminated the anomalies.

2. I applied the same solution to yet another menu -- as an experiment
because the menu worked just fine as it was, albeit with a few
unimportant visual anomalies-- using only multiples of 0.5ex units, or
only multiples of 1ex units: but applying the same solution was not
helpful.

I have not formed any definite conclusion except that, if I have
problems with a vertical menu, I should at least *try* the same
solution, and see what happens.
From: GTalbot on
On 19 oct, 00:54, C A Upsdell <cupsd...(a)nospam.not> wrote:
> dorayme wrote:
> >> There is a view that ex units should be used instead of em units.  I
> >> have recently found that using ex instead of em fixed some cross-browser
> >> issues.  See:
>
> >>      http://kb.mozillazine.org/Em_units_versus_ex_units
>

{
At "normal" font sizes (the defaults on Windows systems, and possibly
Linux and others), 1 em is 10.06667 pixels, and 1 ex is 6 pixels.
}

That's not true. In IE (all versions), the "normal" default font size
is 16px. And if 1em is 16px, then 1ex exact font-size expressed in
pixels depends on the font family in use:

x-height of a font
http://www.cs.tut.fi/~jkorpela/x-height.html

x-height, font aspect value, font-size-adjust
http://brunildo.org/test/xheight.pl

Aspect values for web fonts: Some results
http://www.barrypearson.co.uk/articles/text/aspect_values.htm



> > It is all precious nonsense. It does not matter about small variations
> > and if it concerns anyone, they are obsessing about the wrong things.
>
> What I was "obsessing about", which I solved by switching a particular
> dimension from em to ex units, was a problem with a CSS-based dropdown
> menu:  with Opera, when the user pointed to a menu item, then moved the
> cursor down to the associated dropdown menu, the dropdown menu sometimes
> disappeared.  IMO such a problem in a website is not unimportant.
>
> I was more interested in fixing the problem than in determining exactly
> why the switch to ex units worked, but my suspicion is this:  In the CSS
> used to implement the dropdown menu, a mixture of em and ex units was
> used, and Opera likely handles the relationship between em and ex units
> differently from other browsers, which sometimes resulted in a small
> vertical gap between the menu item and its associated dropdown menu. A
> small gap would normally not be important, but it was important here
> because, when the cursor fell into the gap, the cursor no longer
> :hovered over the menu item or dropdown menu, and so the dropdown menu
> naturally disappeared.  Switching completely to ex units renders
> irrelevant any difference in the relationship between em and ex units.

Correct support for ex unit (and vertical-align) in browsers, in
particular Opera 9+ and IE7, is very buggy.

http://www.gtalbot.org/BrowserBugsSection/MSIE8Bugs/VerticalAlignMiddleBug.html

http://www.gtalbot.org/BrowserBugsSection/MSIE8Bugs/VerticalAlignMiddleBug-3.html

http://www.gtalbot.org/BrowserBugsSection/css21testsuite/background-position-001.html

http://www.gtalbot.org/BrowserBugsSection/css21testsuite/background-position-002.html


IE 8 still has a bug with ex unit.

http://www.gtalbot.org/BrowserBugsSection/css21testsuite/font-size-001.html

Webkit has a bug report on ex:

Incorrect implementation of 'ex' unit
https://bugs.webkit.org/show_bug.cgi?id=16362


I don't recommend to use ex unit for all those reasons.

regards, Gérard
--
Internet Explorer 8 bugs: 57 bugs so far
http://www.gtalbot.org/BrowserBugsSection/MSIE8Bugs/
Internet Explorer 7 bugs: 183 bugs so far
http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/
From: C A Upsdell on
GTalbot wrote:
> On 19 oct, 00:54, C A Upsdell <cupsd...(a)nospam.not> wrote:
>> dorayme wrote:
>>>> There is a view that ex units should be used instead of em units. I
>>>> have recently found that using ex instead of em fixed some cross-browser
>>>> issues. See:
>>>> http://kb.mozillazine.org/Em_units_versus_ex_units
>
> {
> At "normal" font sizes (the defaults on Windows systems, and possibly
> Linux and others), 1 em is 10.06667 pixels, and 1 ex is 6 pixels.
> }
>
> That's not true. In IE (all versions), the "normal" default font size
> is 16px. And if 1em is 16px, then 1ex exact font-size expressed in
> pixels depends on the font family in use:

Confirmed. I created a test page earlier today which computes em and ex
values, and I found these interesting results:

With FF 3.5 running on Windows XP, when an em is 16px, the ex sizes for
Arial, Tahoma, Times New Roman, and Verdana are:

9px 9px 7px 9px

When the size is reduced using font-size:small, the em size is 13px, and
the ex sizes are:

7px 7px 6px 7px

With IE 7, also running on Windows XP, when an em is 16px, the ex sizes are:

8px 8px 8px 8px

When the size is reduced using font-size:small, the em size is 13.33px,
and the ex sizes are:

6.67px 6.67px 6.67px 6.67px

With Opera 10, also running on Windows XP, when an em is 16px, the ex
sizes are:

8px 8px 8px 8px

When the size is reduced using font-size:small, the em size is 13px, and
the ex sizes are:

6.5px 6.5px 6.5px 6.5px

Clearly FF, IE, and Opera use different methods of calculating ex
values, and different methods of calculating the small font size. I
don't like to generalize based on only 4 fonts on one platform, but it
would *appear* that:

1. IE and Opera set the ex value to half the em value.

2. FF sets the ex value to different fractions of the em value,
depending on the font (which is probably more correct).

3. IE makes no attempt to make the ex value an integer, nor does it
make any attempt to make the em value for small fonts an integer.

4. FF and Opera *may* be trying to set the em value for small fonts and
integer, though this is scarcely certain.
From: dorayme on
In article <hbqonf$79u$1(a)news.eternal-september.org>,
C A Upsdell <cupsdell(a)nospam.not> wrote:

> GTalbot wrote:
> > On 19 oct, 00:54, C A Upsdell <cupsd...(a)nospam.not> wrote:
> >> dorayme wrote:
> >>>> There is a view that ex units should be used instead of em units. I
> >>>> have recently found that using ex instead of em fixed some cross-browser
> >>>> issues. See:
> >>>> http://kb.mozillazine.org/Em_units_versus_ex_units
> >
> > {
> > At "normal" font sizes (the defaults on Windows systems, and possibly
> > Linux and others), 1 em is 10.06667 pixels, and 1 ex is 6 pixels.
> > }
> >
> > That's not true. In IE (all versions), the "normal" default font size
> > is 16px. And if 1em is 16px, then 1ex exact font-size expressed in
> > pixels depends on the font family in use:
>
> Confirmed.

So, when I earlier said in this thread:

"Just try this to see how wrong this sounds:

..pixelSet {font-size:10px;}
..emSet {font-size:1em;}

with

<p class="pixelSet">This is font-size: 10px</p>
<p class="emSet">This is font-size: 1em</p>"

it is more than merely sounding wrong to me on my silly Mac.

--
dorayme
From: Andy Dingley on
On 22 Oct, 22:08, GTalbot <newsgr...(a)gtalbot.org> wrote:

> That's not true. In IE (all versions), the "normal" default font size
> is 16px.

Doesn't that depend on the Windows desktop too, and the font scaling
applied there (Display|Properties|Large Fonts)