Re: [selectors] applying pseudo classes to the label based on the labeled control

> On 26 Nov 2014, at 23:26, Florian Rivoal <florian@rivoal.net> wrote:
> 
>> Having this apply to the input pseudo classes[2] might make sense as well.
> 
> However, I forgot to bring this part up. What does everyone think?

Today during the conf call I was asked for evidence that this is actually something authors want. Here's some:

Stack overflow question wanting label:for(:disabled) :
http://stackoverflow.com/questions/19362716/how-to-style-a-html-label-for-disabled-input

Stack overflow question wanting label:for(:checked) :
https://stackoverflow.com/questions/21703642/styling-label-of-a-hidden-radiobutton
https://stackoverflow.com/questions/4641752/css-how-to-style-a-selected-radio-buttons-label
https://stackoverflow.com/questions/16565032/checkbox-label-not-styling-when-checked

Code found on github which puts the label after the input to use the + selector, but could use more semantic markup with the for attribute and use label:for(:valid) label:for(:invalid) and label:for(:required) instead if they existed:
https://github.com/hieunguyenminh93/mvc/blob/9fe3ce1323f2b47e9e71140629e34a91d1837cea/install/view/css/form.css

An example on Tab's side (click on the ingredients) which would work without artificially convoluted markup if it could do label:for(:checked)
https://www.dropbox.com/s/cyu9je5a6cvolyf/Screenshot%202014-12-03%2023.51.47.png?dl=0

- Florian

Received on Wednesday, 3 December 2014 23:27:50 UTC