W3C home > Mailing lists > Public > public-respimg@w3.org > October 2014

Informing the browser of the expected size of the image

From: <steve@steveclaflin.com>
Date: Mon, 27 Oct 2014 12:03:41 -0500
To: public-respimg@w3.org
Message-ID: <78cb942746d65573cc4ae1e6a7934f42@steveclaflin.com>
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 

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:06:15 UTC