W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 7 Sep 2012 09:36:52 -0700
Message-ID: <CAAWBYDB6Tesq36FR5R3_DX07umps0YbLwkREfv0q6pfZ7jh3AA@mail.gmail.com>
To: Hans Muller <hmuller@adobe.com>
Cc: John Mellor <johnme@chromium.org>, WHATWG List <whatwg@whatwg.org>
On Fri, Sep 7, 2012 at 9:21 AM, Hans Muller <hmuller@adobe.com> wrote:
> On 9/6/12 6:36 PM, "Tab Atkins Jr." <jackalmage@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;">

That's basically equivalent to what I wrote.  I just added an
additional (technically superfluous) 1x to the final declaration.  The
problem, as I noted, is that it means you're duplicating the
"1600.jpg" url, which is a minor editting hazard.  This kind of
"solution" also only works in this specific case, when you're only
dealing with two densities and no art direction.

Received on Friday, 7 September 2012 16:37:46 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC