W3C home > Mailing lists > Public > www-style@w3.org > October 2005

Re: Styling by attribute-based association?

From: ACJ <ego@acjs.net>
Date: Tue, 25 Oct 2005 22:02:03 +0200
Message-ID: <435E8F3B.8060805@acjs.net>
To: Matthew Raymond <mattraymond@earthlink.net>
CC: W3C CSS <www-style@w3.org>
The CSS2 attribute selector [1] allows you to style labels with a for 
attribute like this:

label[for] { border: thin dashed }

The first case you discribe (1) is not possible with current CSS, but 
one could argue if it should. It sounds like behaviour to me (and should 
therefor be handled by script).

Sincerly,

ACJ

[1] http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors

Matthew Raymond wrote:

>   How does one style an element based on whether it has an association
>to another element via an attribute? Specifically, how do I style a
><label> with a |for| attribute?
>
>   Situations where this would be useful:
>
>1) You want the label to have a dashed border when the associated
>control is selected.
>
>2) You want non-associated labels do have a different style from
>associated labels, even in cases where a <label> has an incorrect |for|
>attribute value.
>
>3) You want all labels for a specific control or class of controls to be
>styled in a specific way.
>
>   Is a new selector required in this case? For that matter, is a new
>selector needed for parent-child <label> associations? This affects both
>existing HTML markup and new markup proposals.
>
>
>  
>

Received on Tuesday, 25 October 2005 20:00:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:41 GMT