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

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

From: Kornel Lesiński <kornel@geekhood.net>
Date: Sun, 13 May 2012 20:31:40 +0100
To: whatwg@lists.whatwg.org
Message-ID: <op.wd9hu2wlte2ec8@aimac.local>
On Sun, 13 May 2012 01:33:25 +0100, Mathew Marquis <mat@matmarquis.com>  

> 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.

In the long term that may be a very sensible approach. Selection of 1x/2x  
images is relevant only as long as we have 100dpi screens and slow  
connections, and both will disappear over time.

Perhaps we should think about making syntax for 200dpi+ images with  
intrinsic dimensions easy?

Selection between images for different screen sizes/orientations isn't a  
problem that will go away any time soon, so I think <picture> is a good  
idea regardless of solution for DPI/bandwidth problem.
As long as HTML claims to be independent of CSS there is no solution for  
that (i.e authors shouldn't be adding multiple <img> and showing one of  
them with CSS).

How about that:

	<source src="narrow_low-quality" srcset="narrow_hi-quality 2x"  
	<source src="wide_low-quality" srcset="wide_hi-quality 2x">

	<img src="fallback" alt="alt">

Instead of srcset it could be src2x or another attribute that specifies  
image for higher screen density and/or bandwidth. The point is that  
media="" would allow author to choose image version adapted to page  
layout, and another mechanism connected to <source> would allow UA to  
choose image resolution.

regards, Kornel Lesiński
Received on Sunday, 13 May 2012 19:32:21 UTC

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