- From: Taylor Hunt via GitHub <sysbot+gh@w3.org>
- Date: Sun, 08 Apr 2018 18:58:19 +0000
- To: public-css-archive@w3.org
@therealglazou That *would* be nice, but `<label>`s can also be associated with descendant form elements without ID/IDREFs, so this seems to have a slightly larger scope.
As an author, this is a somewhat silly example of what I would love to use this functionality for:
```html
<label>2 + 2 = ?
<svg><use href="#correct" /><use href="#incorrect" /></svg>
<input name="answer" pattern="4" required />
</label>
```
```css
use {
display: none;
}
label:valid > [href="#correct"],
label:invalid > [href="#incorrect"] {
display: inline;
}
```
It’s sort of possible today to do this by placing the elements after the form element in question and using something like `input:valid ~ foo`, but that can be impossible with certain markup output — it’s common to wrap `<select>` inside a `<span>` for styling purposes, for example.
--
GitHub Notification of comment by tigt
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/397#issuecomment-379573559 using your GitHub account
Received on Sunday, 8 April 2018 18:58:52 UTC