Informing the browser of the expected size of the image

I'm arriving late to the responsive images discussion, but have one 
strong opinion in an area that I believe is not served: informing the 
browser about the expected size of the image so that it can reserve the 
appropriate space.

Prior to max-width in CSS, I would provide width and height attributes 
to the img tag, so that the browser could allocate space immediately, 
and not need to reflow when the image data arrived and it learned the 
size.

But, with the advent of max-width I had to stop doing that, since the 
height would cause the aspect ratio to get distorted.  I don't believe 
that there is any way to get around this.  (I have found ways to turn 
off the height attribute with CSS of height: auto, but who's to say that 
the browser should keep note of the original height and assume that if 
it resizes due to max-width, it should keep the same aspect ration.)

Now, in particular, when we could have images with different aspect 
ratios, it seems like the browser wouldn't know until it downloads one 
what the aspect ratio is.  And we might end up with a very jumpy page.

Do the current specs for img with sizes or picture provide any mechanism 
for this?

If not, it seems that it wouldn't be all that difficult to add a new 
attribute or two to accomplish this.

Received on Wednesday, 29 October 2014 21:07:01 UTC