[whatwg] <img> element comments

Ian Hickson ian at hixie.ch
Sat Nov 29 13:51:10 PST 2008


On Wed, 6 Aug 2008, Simon Pieters wrote:
> On Wed, 06 Aug 2008 22:06:33 +0200, Ian Hickson <ian at hixie.ch> wrote:
> >
> > <meter> is probably the right element for this. You can use fallback 
> > content in the <meter> element to show text in legacy browsers that 
> > don't support HTML5.
> > 
> > [mpt wrote:]
> > > And it seems a little excessive to need to construct a <canvas> when 
> > > all we want to do is stretch an image horizontally.
> > 
> > What you want to do is show a graph, not stretch an image. The image 
> > is just the way you've found to do it. However, I don't think it's a 
> > valid solution.
> 
> I don't think this is any more abuse of <img> than e.g. "A group of 
> images that form a single larger picture" or "An image not intended for 
> the user".

You'll notice that the spec has SHOULD-level requirements saying that 
authors shouldn't do those two things too.


> > You're saying that the meaning of the image is affected by the 
> > dimensions at which it is drawn, which seems very dubious since it 
> > means you would lose the meaning if you just copied the image, or if 
> > you lost the context (the width only means something relative to other 
> > widths), etc.
> 
> "A group of images that form a single larger picture" would also lose 
> the meaning if you just copied the image, or if you lost the context.

That's why it is discouraged.


> > > So to reiterate Henri's point, given that browsers (I assume) have 
> > > to obey disproportionate width= and height= attributes for 
> > > compatibility with the Web anyway, I don't see the point of 
> > > requiring authors to make them match the image's proportions.
> > 
> > The point is to catch errors (aspect ratio mistakes) when authors are 
> > using HTML in a more appropriate manner.
> 
> Validators can still issue warnings to help with aspect ratio mistakes 
> without putting up a road block for authors trying to migrate to HTML5.

The same argument is made for keeping other features, e.g. bgcolor="", 
cellpadding="", <font>... If we want the Web to ever become truly media- 
independent and device-independent, we have to draw a line somewhere. 
The idea of HTML4 Transitional was to let authors transition to this new 
world. Well, they've had ten years. Now it's time for the transition to be 
taken to the next step, and make the deprecated stuff obsolete. I agree 
that <img> stretching wasn't explicitly deprecated in HTML4, but it seems 
pretty clear to me that it's part of the same problem.


> Moreover, currently the spec bans this, which seems legitimate enough:
> 
>    <img src=800x600.jpg width=333 height=250>

Fixed.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list