W3C home > Mailing lists > Public > www-style@w3.org > December 2014

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

From: Florian Rivoal <florian@rivoal.net>
Date: Thu, 4 Dec 2014 00:27:25 +0100
Message-Id: <80C2A974-84F2-4CF6-BB5F-6E56FA339500@rivoal.net>
To: www-style list <www-style@w3.org>

> 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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:26 UTC