Re: :click pseudo element

On Mon, Feb 7, 2011 at 10:31 AM, Tantek Çelik <tantek@cs.stanford.edu> wrote:
> On Mon, Feb 7, 2011 at 10:20, Brad Kemper <brad.kemper@gmail.com> wrote:
>> It'd be nice to have a way to replicate radio-button behavior. Something like:
>>
>> a:clicked(odd) { /* on state */ }
>> a:clicked(even) { /* off state */ }
>>
>> ... where only a mouse-up counted as as 'clicked'.
>>
>> Although it would be better if there was some sort of actual binary state that could be attached to any element and styled.
>
> Right.
>
> Once we start talking about user-meaningful (binary) "states" like
> that, we've crossed-over into semantics (meaning of the
> document/page/webapp) and much better to keep/leave that in HTML.
>
> However, once such a state is defined in your markup (i.e. the HTML
> specification defines when which elements are in on/off states), then
> you can use UI Selectors to apply styling to it:
>
> http://www.w3.org/TR/css3-selectors/#UIstates
>
> reworking your sample style sheet:
>
> a { /* off state */ }
> a:checked { /* on state */ }

Agreed with both of you, that this is a valuable addition, and that
it's best to solve this at the HTML level and then let CSS hook into
it.

~TJ

Received on Monday, 7 February 2011 21:08:29 UTC