[whatwg] Media queries, viewport dimensions, srcset and picture

Florian Rivoal florianr at opera.com
Thu May 24 05:16:28 PDT 2012


On Thu, 24 May 2012 11:35:35 +0200, Markus Ernst <derernst at gmx.ch> wrote:

> Am 24.05.2012 11:13 schrieb Matthew Wilcox:
>> I agree, the problem is that... it's still a problem. It's not always
>> a cropped version, it's sometimes a different image entirely - but we
>> can only sense the viewport rather than the space into which an image
>> is sitting. Because we can only sense the viewport we are actually
>> hooking into the design itself rather than being able to automate
>> things based on "how much room is there for this image?". However it's
>> cut, future maintenance is going to be a problem.
>>
>>> - New designs usually require other image dimensions, meaning that  
>>> images
>>> have to be recreated anyway.
>>
>> That's true, but the problem isn't so much that as it is that there
>> will be different breakpoints. It's unlikely we'd be working with the
>> same breakpoints, so the one's in the mark-up are all wrong. Leading
>> to incorrect image selection. It's not trivial to revisit all mark-up
>> to correct this.
>
> Once CSS variables are available, would it be possible to reference them  
> from the @media attribute? Given a variable "breakpoint1" is defined in  
> the CSS file:
>
> <source media="(min-width:var(breakpoint1))" srcset="tall.jpg 1x,  
> tall2.jpg 2x">

CSS variables as proposed can't work like that, as they rely on the
cascade.

   - Florian



More information about the whatwg mailing list