Re: [csswg-drafts] Allow applying style rules to the container itself (especially with style querries) (#10744)

Correct :)

The subtle differences I was referring to are more with this kind of case:

```html
<div class="parent" style="--color: pink">
  <div class=child>
    hello
  </div>
</div>
```

```css
@container style(--color: pink) {
  :container {
    background-color: rgb(from pink r g b / 0.3);
  }
}
```

Would `:container` match both the `.parent` and `.child` elements?
I would expect it to.

---

```html
<div class="parent" style="--color: pink">
  <div class=child>
    hello
  </div>
</div>
```

```css
.parent {
  container-name: a-container;
}

@container a-container style(--color: pink) {
  :container {
    background-color: rgb(from pink r g b / 0.3);
  }
}
```

Here it should definitely only match `.parent`.

------

With `@element` this nuance doesn't exist.
It would always match any element with `--color: pink`;

In that way a `:container` pseudo might be a better approach?

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


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

Received on Friday, 16 August 2024 10:57:36 UTC