[whatwg] srcset isn't future-friendly to screen size differences

Hans Muller hmuller at adobe.com
Fri Sep 7 09:21:38 PDT 2012


On 9/6/12 6:36 PM, "Tab Atkins Jr." <jackalmage at gmail.com> wrote:

>Consider the following example:
>
><img srcset="800.jpg 1x, 1600.jpg 2x" style="width: 100%; height: auto;">
>
>For a screen that's somewhere near 800px wide, this works just fine.
>However, a 1x screen 1600px wide (not too uncommon - I think a 19"
>monitor is roughly that width) will get served the 800.jpg image,
>which then gets blown up to an unattractive level.

In this particular case, without considering other display densities,
wouldn't this suffice:

   <img src="1600.jpg" srcset="800.jpg 800w 1x, 1600.jpg 800w 2x"
style="width: 100%; height: auto;">

It's a shame that one can't explicitly say that the UA can use display
density 
arithmetic to select substitute images.  On the other hand, ror cases like
this, 
specifying a src image for viewports that are "larger" than the ones
specified 
with srcset seems like a good idea.

- Hans




> 




More information about the whatwg mailing list