http://dlang.org/bugstats.php

%u noreply at example.com
Mon Jan 23 07:13:14 PST 2012


== Quote from Denis Shelomovskij (verylonglogin.reg at gmail.com)'s article
[...]
>
https://github.com/D-Programming-Language/d-programming-language.org/blob/master/bugstats.php.dd#L24
> width="48em" height="18em"
> Font size is about 14px so these areas for few digits are very big:
> ~700px x 250px. Opera and Chrome incorrectly displays it as if 1em =
> 1px. Firefox displays correctly (and ugly) unless you rewrite it into
> `width="48.0em" height="18.0em"`.
> So am I missing something? If no, why does Opera, Chrome and Firefox
> incorrectly display such a simple page?
> Why does Andrei use `em` in this case instead of px?

The HTML attributes width and height are not equivalent to the CSS properties of
the same names. The HTML attributes are not meant to hold em values. Undefined
behaviour fun is the result. Both of the browers' approaches to handle the
situation are sensible.

The idea behind using em there is probably to get an iframe that matches the text
in height, even if the user agent uses an exotic font-size. However, using an
iframe is working against that: The em values refer to the font-size of the
context its in, but really you want something proportional to its content. But
that's not possible as far as I can tell. Generally, using iframes there is just
calling for trouble.


More information about the Digitalmars-d-announce mailing list