Re: [csswg-drafts] [css-shadow-parts] Specifying named slot in styling its slotted content (#8577)

A comparison with #7922 would be useful. With the combinator syntax, the examples in the OP could be written as:


```css
slot {
  /slotted/ p:first-child { ... }
  /slotted/ div + div { ... }
}
```

with a named slot:

```css
slot[name="one"]{
  /slotted/ p:first-child { ... }
  /slotted/ div + div { ... }
}
```

So far the opposition to #7922 has been around implementation difficulty, so it would be useful to hear from implementors about whether something like this can be implemented more easily.

Another related proposal is #10941 which more broadly allows escaping the shadow DOM (akin to `:global()` in some JS frameworks). Though to use it for the use cases here would require some way to target the host from the outside (either a fixed tag name or a `:state()`), which is not as elegant.

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


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

Received on Tuesday, 4 November 2025 20:04:56 UTC