Re: Image width specification in html5

On 21 November 2011 08:44, Michael[tm] Smith <mike@w3.org> wrote:

> Try doing using width="75%" height = "75%" and compare the rendering in
> several different browsers.


It appears to be extremely consistent, and consistent with the HTML 4.01
specification[1]: All of the browsers I had handy (a mix of current and
older) did exactly the same thing: The image is scaled to the given
percentage of the available space and (if both width and height were given)
the aspect ratio was sacrificed:

Just width (25%): http://jsbin.com/egicuq
Just height (25%): http://jsbin.com/egicuq/2
Width & height (25%): http://jsbin.com/egicuq/3
Width & height (75%): http://jsbin.com/egicuq/4

Browsers tested:

On (various versions of) Windows:
* Chrome 15 (WebKit)
* Opera 11 (Presto)
* IE6/7/8/9 (various versions of Trident)
* Firefox 5 (Gecko)
* Safari 5 (WebKit)

On Linux (Ubuntu 11.10):
* Chrome 15 (WebKit)
* Firefox 7 (Gecko)
* Konqueror 4.7.2 (KHTML)
* Midori 0.4.0 (WebKit)
* Epiphany 3.0.4 (WebKit)

On iOS 4.2:
* Mobile Safari 5.0.2 (WebKit)

Granted mobile browsers are under-represented there, but the degree of
consistency is very high indeed across layout engines.

On 21 November 2011 08:47, Jukka K. Korpela <jukka.k.korpela@kolumbus.fi>wrote:

> By the way, it occurred to me that constructs like width="25px" are not
> uncommon on web pages and are generally processed by browsers as if the
> attribute were width="25".
>

Perhaps, but `width="25%"` doesn't fall into that category.

It would appear that inconsistency in implementation is not the
justification for removing this, but rather the desire to offload
presentation to CSS. But that's an argument for removing `width` and
`height` from `img` entirely, not for selectively removing percentage
values.

[1] http://www.w3.org/TR/html401/struct/objects.html#adef-width-IMG
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

Received on Monday, 21 November 2011 10:22:39 UTC