[whatwg] Problems with width/height descriptors in srcset

Markus Ernst derernst at gmx.ch
Fri May 18 02:17:43 PDT 2012


Am 17.05.2012 19:48 schrieb Tab Atkins Jr.:
> 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.

<h1><img src="small.png" srcset="medium.png min-width:30em, large.png 
min-width:50em"></h1>

<p><img src="small.png" srcset="medium.png min-width:30em, large.png 
min-width:50em"></p>

Is em different in these 2 elements, or is it actually rem? And whatever 
answer, is it a problem or a feature?



More information about the whatwg mailing list