Re: Styling by attribute-based association?

Ian Hickson wrote:
> On Tue, 25 Oct 2005, David Hyatt wrote:
> 
>>Another (IMO simpler) idea would be to just have label match the same 
>>pseudo-classes that the control does, i.e., if a checkbox is :checked, 
>>then the label can match :checked too.  Same for :disabled, :enabled, 
>>:indeterminate, and :focus.  I don't see any reason to introduce new 
>>selectors to solve this problem.
> 
> 
> That doesn't address all of Matthew's requests, and would be specific to 
> <label>, not addressing similar problems with elements such as <map>, etc. 
> But I agree that it might make sense too.

   Another problem with David's idea is that it fails to address styling
based on attribute values rather than selectors. An example would be
specific labels for specific <input> types in HTML:

| label:friend(for, input[type=datetime])

   Then there's the associations to elements with specific classes or IDs:

| label:friend(for, .myClass)
| label:friend(for, #myID)

   Also, David's idea is misleading in some cases. As <label> has been
redefined in Web Forms 2.0, a label may not be able to have focus, for
instance. (Then again, it may be that we don't what this kind of styling
anyways, considering UI conventions. Yet, there again, if
non-conventional UI behavior is implemented, you'd significantly
complicate the method of styling that way.)

Received on Tuesday, 25 October 2005 21:28:02 UTC