[whatwg] Problems with width/height descriptors in srcset

Tab Atkins Jr. jackalmage at gmail.com
Thu May 17 10:48:47 PDT 2012


On Thu, May 17, 2012 at 10:27 AM, Jeremy Keith <jeremy at adactio.com> wrote:
> Tab wrote:
>> Absolutely agreed.  Like several others have suggested, I think we
>> should just go with a "min-width:100px" approach, which is much
>> clearer.  It also lets us add "max-width", though that may complicate
>> the resource choosing algorithm a bit.
>
> Just to be clear, do you mean changing the syntax so that Nw is replaced with min-width:N?
>
> e.g.
>
> <img src="small.png" srcset="medium.png min-width:600px, large.png min-width: 800px">
>
> or
>
> <img src="large.png" srcset="medium.png max-width:800px, small.png max-width: 600px">

Yes, you got it.

> Those two examples would then be functionally equivalent (give or take a single pixel) but allow developers to take a "Mobile First" or "Desktop First" approach according to their preference.
>
> Related question: do we still want to keep this unit-less i.e. ditch the "px" from the examples above? Or, if we're going to use this CSS-like syntax anyway, allow other units of measurement (e.g. ems).

No, if we're aping the CSS syntax more closely, we should just use CSS units.

~TJ



More information about the whatwg mailing list