[whatwg] require img dimensions to be correct?

Dean Edridge dean at 55.co.nz
Fri Mar 16 07:46:56 PDT 2007

Regarding: img dimensions to be correct?

Sander Tekelenburg wrote:

> We struggled with this for the WRI requirements[*]. We seem to be settling on
> requiring a width and height to be specified in HTML, because as nice as CSS
> is, Web pages must not be CSS-dependant. Even if the author means to provide
> CSS, it might not be available (network/server error; saving and local
> viewing of the HTML file; User CSS overrides) (A followup requirement would
> probably have to be that when CSS is available, and specifies IMG size in px,
> it must be the same as the size specified in the HTML.)
> The only other sensible option would be to completely disallow width and
> height in HTML. But that will result in 'jumpy rendering' because browsers
> can't allocate the proper rendering space until the image's dimensions are
> known.
> [*] <http://webrepair.org/02strategy/02certification/01requirements.php> Btw,
> this is our initial take. We very much welcome community feedback.
I don't really think this is a good idea IMHO.

Firstly, the chance of someone not being able to access the CSS for a 
web page is I'm guessing, pretty slim.
The chance of someone not being able to access this CSS, *and* actually 
noticing or caring that the images aren't rendered correctly (if in fact 
they aren't), is very  very slim. So I don't think it's really worth 
throwing away the benefits of CSS just for a very rare occasion like 
this that would probably not be of benefit to anyone anyway.

Secondly, when scaling images you would normally just set the height, 
not the width. This ensures that the images proportions are kept intact, 
as specifying a width distorts the image.

This being said I hope no one makes it a requirement to specify just the 
in-line height, as this would still create problems. For example if you 
had an images height set within the html to 100% of the parent elements 
height, and there was no CSS available to specify the parents height 
(for example a div), the user agent would probably just stretch the 
image to the full height of the screen (FF doesn't do this, but IE and 
Opera do), therefore causing more problems than if you had just left all 
the styling in the CSS to begin with. So the long and the short of it 
IMO is to just use CSS and rely on the user-agent to show the page the 
best it can in the absence of CSS.


-- Dean Edridge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070317/730c3ba8/attachment-0001.htm>

More information about the whatwg mailing list