Re: [csswg-drafts] [css-conditional] [css-contain] `srcset` and `sizes` interaction with container queries (#5889)

This seems **really** exciting for art direction (e.g., `<picture><source container>` or whatever).

However, part of the goal of `<source media>` and `srcset` + `sizes` is to allow UAs to load images _immediately_, using information contained within markup alone, and I don't see how you resolve a `cw` or a `container()` or whatever, without waiting for style and layout.

For art direction... maybe that's a high performance price we have to pay to enable art direction within responsive components, which seems important.

But for `sizes` and `srcset` selection, once you've waited for layout, you don't need `sizes` at all. (See also: https://github.com/whatwg/html/issues/4654)

I can maybe see a path forward to instant loading here if the queried container, itself, has a `sizes` attribute, which can be resolved using just viewport size... e.g.

```
<div
  class="container"
  sizes="(min-width: 800px) 800px, 100vw" />
  <img
    srcset="small.jpg 400w, medium.jpg 800w, large.jpg 1200w"
    sizes="container(min-width: 600px) 33cw, 100cw"
  />
  [more images with the same sizes go here]
</div>
```

But writing `sizes` is already extremely difficult; this figures to make it worse.


-- 
GitHub Notification of comment by eeeps
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5889#issuecomment-777918275 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 12 February 2021 01:59:52 UTC