Re: Informing the browser of the expected size of the image

On Fri, 07 Nov 2014 18:39:29 +0100, <steve@steveclaflin.com> wrote:

> I agree in terms of best practices, but I don't think the spec for img  
> disallows the use of urls with different aspect ratios in srcset.  So  
> then a question arises as to whether the syntax should support legal but  
> bad practices.

We don't need to support bad practices. We should generally make it hard  
to use a feature incorrectly. That suggests it shouldn't be possible to  
specify different aspect ratios for different URLs in srcset, since they  
should all be the same.

However, it's possible that rounding errors causes the aspect ratios in  
srcset to be slightly different. For instance, say you have an image that  
is 1000x200. A scaled down version could be 333x67, which is perfectly  
fine but is different aspect ratio. If we want the placeholder box to have  
exactly the right size, this suggests we should allow (but not necessarily  
require) specifying width/height or aspect ratio for each URL.

Also see https://github.com/ResponsiveImagesCG/picture-element/issues/85  
for more discussion.

-- 
Simon Pieters
Opera Software

Received on Monday, 10 November 2014 10:15:18 UTC