[whatwg] <img> element comments

Spartanicus spartanicus.3 at ntlworld.ie
Sat Nov 4 04:33:23 PST 2006

Ian Hickson <ian at hixie.ch> wrote:

[width and height attribute on the <img> element]

>I'm thinking of only allowing integer values, and requiring them to be 
>equal to the dimensions of the image, if present (and requiring both to 
>be present if either is present). Would people be ok with that?

Definitely on the integer value only, allowing percentage values makes
no sense to me.

In some cases I have used just one attribute
http://homepage.ntlworld.ie/spartanicus/fit_image_in_column2.htm , but
on examination this does not only have no benefit, it needlessly causes
the single coded image size to be reserved in the flow if for example a
graphical client is configured to not initially retrieve images. When
omitting both attributes the element's size collapses to the size of the
alt content, whilst the reflow on a possible subsequent retrieval of the
image occurs anyway in this particular scenario.

Meanwhile allowing authors to omit width & height together caters for
situations where better functionality is achieved if the natural
dimension of the image isn't reserved on the initial flow layout. The
required reflow on a subsequent retrieval of the image can be considered
preferable compared to the alternative where potentially valuable screen
space may be wasted to reserve space in the initial flow for the natural
size of the image.

So I also support requiring both to be present if either is present.

But wouldn't requiring the width & height values to be equal to the
natural dimension of the image require conformance checkers to have a
capability to parse images to retrieve these values?


(email whitelist in use, non list-server mail will not be seen)

More information about the whatwg mailing list