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

Kornel Lesiński kornel at geekhood.net
Sun May 13 12:31:40 PDT 2012


On Sun, 13 May 2012 01:33:25 +0100, Mathew Marquis <mat at 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.

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:

<picture>
	<source src="narrow_low-quality" srcset="narrow_hi-quality 2x"  
media="max-width:4in">
	<source src="wide_low-quality" srcset="wide_hi-quality 2x">

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


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



More information about the whatwg mailing list