Re: [csswg-drafts] [css-contain-3] Make `<container-query>` optional in `@container` (#9192)

Note that if you want the condition to be true, `width >= 0` is safer than `width < 100vw`.

Also the grammar would be simpler as `<container-condition> = <container-name> || <container-query>`.

Still, the problem with this proposal is that cq units are not tied to the container query, so even if using `@container word-card`, they can resolve against a different container:

```html
<!DOCTYPE html>
<style>
@container foo (width >= 0) {
  #target {
    width: 100cqw;
    height: 100cqw;
    background: yellow
  }
}
</style>
<div style="width: 200px; border: solid cyan; container: foo / inline-size; --total-aspect-ratio: 1">
  <div style="width: 100px; border: solid magenta; container: bar / inline-size">
    <div id="target"></div>
  </div>
</div>
```

![](https://github.com/w3c/csswg-drafts/assets/7477678/fbb61536-20e1-4bbd-83e6-aaa95c466a51)

The idea is that `cqw(foo)` would allow

![](https://github.com/w3c/csswg-drafts/assets/7477678/bbccdb64-8456-496c-bcf5-4eca9b5f1e0a)



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


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

Received on Tuesday, 15 August 2023 18:28:17 UTC