[whatwg] <img srcset> for responsive bitmapped content images

Julian Reschke julian.reschke at gmx.de
Wed May 16 02:22:07 PDT 2012


On 2012-05-10 09:58, Edward O'Connor wrote:
> Hi,
>
> When authors adapt their sites for high-resolution displays such as the
> iPhone's Retina display, they often need to be able to use different
> assets representing the same image. Doing this for content images in
> HTML is currently much more of a pain than it is in CSS (and it can be a
> pain in CSS). I think we can best address this problem for bitmap[1]
> content image by the addition of a srcset="" attribute to the existing
> <img>  element.
>
> The srcset="" attribute takes as its argument a simplified variant of
> the image-set() microsyntax[2]. It would look something like this:
>
> <img src="foo-lores.jpg"
>       srcset="foo-hires.jpg 2x, foo-superduperhires.jpg 6.5x"
>       alt="decent alt text for foo.">
> ...

Inventing a new microsyntax is tricky.

- "comma separated" implies you'll need to escape a comma when it 
appears in a URI; this may be a problem when the URI scheme assigns a 
special meaning to the comma (so it doesn't affect HTTP but still...)

- separating URIs from parameters with whitespace implies that the URIs 
are valid (in that they do not contain whitespace themselves); I 
personally have no problem with that, but it should be kept in mind

Best regards, Julian



More information about the whatwg mailing list