- From: wimbarelds via GitHub <noreply@w3.org>
- Date: Tue, 17 Mar 2026 16:26:59 +0000
- To: public-css-archive@w3.org
> > Note that with a combinator to go from target to invoker, we get that for free, via :has().
>
> I don't doubt it's possible using all the magic of modern CSS but off the top of my head I can't quite picture it. Can you show an example CSS snippet to do it?
I think he means that, given
```
<label for="something">Text</label>
<input id="something">
```
If you can go from label to associated input using:
```css
label /idref(for)/
// or
label /interestfor/
```
Then you can probably find the label that has a referenced input
```css
label:has(/idref(for)/)
// or
label:has(/interestfor/)
```
Or perhaps a more useful example might be
```css
label:has(/ifref(for)/:invalid) {
color: red;
}
// or
label:has(/interestfor/:invalid) {
color: red;
}
```
To select labels with an invalid associated input
--
GitHub Notification of comment by wimbarelds
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12436#issuecomment-4076287811 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 17 March 2026 16:27:00 UTC