[whatwg] Features for responsive Web design

Mikko Rantalainen mikko.rantalainen at peda.net
Wed May 16 00:14:38 PDT 2012

2012-05-16 03:26 Europe/Helsinki: Tab Atkins Jr.:
> On Tue, May 15, 2012 at 5:15 PM, Jason Grigsby <jason at cloudfour.com> wrote:
>> In the @srcset syntax, I *think* I would end up with something like this:
>> <img src="a.png"
>>     srcset="a-rectangle.png 300w 150h 1x,
>>             a-square.png 100w 100h 1x">
> Nope, what you want is this:
> <img src="a-square.png" srcset="a-rectangle.png 600w">
> Use "a-square.png" by default, and "a-rectangle.png" only if the
> window is at least 600px wide.
> I agree that the syntax doesn't make this obvious - it's *too*
> compact, so there's no redundant indicators of what the "w" number
> means.

I think that the correct syntax would be

    <img src="a-square.png" srcset="a-rectangle.png 2x 600w">

because the author assumes that the image will be rendered as 300x150.

I agree that the @srcset can handle the "art-directed" use case as well,
but one needs to specify media-query-like value for the "w" parameter
and then compute the "x" parameter to match the expected size of the
image. In many cases, the "x" parameter will have a non-integer value.
Not as simple as most authors would want but I think that's acceptable.

I think that the "k" parameter for the size in kilobytes should be
included in the spec. Even if it weren't used for bandwidth responsive
use by UAs, it could be used for other stuff (for example, computing the
amount of bytes that the full page still requires and as a result, being
able to display accurate progress bar for page loading).


More information about the whatwg mailing list