This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
hello, I think people expect to see working an expression like this: <style> label:checked{background:lime;} </style> <label for="asd">Check me</label> ... <input type="checkbox" name="test" id="asd"> hope this helps
Indeed, it would be nice. Currently we are forced to place LABEL exactly after INPUT and use adjacent-sibling combinator to style LABEL: INPUT + LABEL {...} Someone may say that it's not about HTML, but about CSS. However, same way as we have input.checked JS property, we could have label.checked JS-property. CSS could then just add corresponding selector to reflect this.
This can be addressed with some new additions in Selectors 4, without any necessary change to HTML. If you have <label for>, it can be done with a selector like "label! /for/ :checked". This uses the reference combinator ("/for/" <http://dev.w3.org/csswg/selectors4/#idref-combinators>) to link the label to its input, and uses the subject indicator ("!" <http://dev.w3.org/csswg/selectors4/#subject>) to indicate you're trying to select the label, not the input. If you have a plain <label> that contains its input, you can use "label! :checked", again using the subject indicator to select the label instead of the input.
This is a CSS/selectors issue.