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

Re: [whatwg] Implementation complexity with elements vs an attribute (responsive images)

From: Maciej Stachowiak <mjs@apple.com>
Date: Sun, 13 May 2012 18:40:08 -0700
Message-id: <75C382E5-DD0B-4D05-BE27-454CD1E5D122@apple.com>
To: Mathew Marquis <mat@matmarquis.com>
Cc: whatwg@whatwg.org

On May 12, 2012, at 5:33 PM, Mathew Marquis <mat@matmarquis.com> wrote:

> I worry that, when faced with this markup, developers will simply opt to serve the largest possible image in a src. In fairness, that approach "works" with far less headache.

For the resolution-adaptation use case, that wouldn't do the right thing by itself because it wouldn't downscale. <img src="foo.jpg" srcset="foo-highres.jpg 2x"> is the minimum you need to get proper fallback. When/if all browsers support srcset (assuming it is even selected), you could omit the src containing the 1x image and this would be a perfectly valid choice. The key issue here, and a big difference from the <picture> approach, is that to actually get higher resolution on a high-rez display, you need to rescale the image to below its normal intrinsic size. You can do this by explicitly styling it to a fixed size, by using an explicit image resolution, or through the 2x shorthand as above. But for compatibility reasons it can't just happen automatically or images meant to be viewed at 1x will be too small.

Received on Monday, 14 May 2012 01:40:37 UTC

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