[whatwg] Problems with width/height descriptors in srcset
jeremy at adactio.com
Thu May 17 10:59:05 PDT 2012
> Well, right now the spec text says:
> "omitted width descriptors and height descriptors are considered to have the value "Infinity""
> Does that mean I could ditch the 92000w and just leave it blank?
> <img src="small.png" srcset="small.png 600w, medium.png 800w, large.png">
But I know realise that, according to the spec, I *must* specify at least one value. So actually I'd have to write:
<img src="small.png" srcset="small.png 600w, medium.png 800w, large.png 1x">
...which seems to muddy the waters a bit. I actually don't care about the pixel-density of the device in this case, but I need to write 1x because I have to include at least one value.
I much prefer Tab's suggestion:
> I think we should just go with a "min-width:100px" approach, which is much clearer.
> It also lets us add "max-width"
> 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).
And Tab replied:
> No, if we're aping the CSS syntax more closely, we should just use CSS units.
I agree. Seems like the sensible approach. It also allows authors who are using ems for their media queries in CSS to also use ems for their srcset declarations.
a d a c t i o
More information about the whatwg