RE: :click pseudo element

> From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf
> Of Tab Atkins Jr.
> Sent: Monday, February 07, 2011 9:08 AM
> To: thomasin a
> Cc: www-style@w3.org
> Subject: Re: :click pseudo element
> 
> On Sat, Jan 29, 2011 at 2:19 PM, thomasin a
> <nevereatredjellybeans@gmail.com> wrote:
> > In order to fully realise the use of the new CSS3 transformation and
> transition abilities, I think a :click pseudo element needs to be added,
> identical to :hover but with the click being the trigger instead. I have
> noticed a lot of people want it, instead reverting to a few short lines of
> Javascript when instead you could make a CSS and HTML pure site, with the
> code being a lot simpler and easy to understand too.
> >
> > I hope you've considered this, and will consider it, because it is a
> Javascript function I use almost every time I program, and it would be a
> lot easier and useful to have it in CSS as well.
> 
> The :active pseudoclass is what you want.  On devices that use a mouse,
> :active matches while you're clicking on the element.  On other types of
> devices with different interactions, :active matches at the appropriate
> time.
> 
> If someone is using js just to change some CSS while people click on
> something, please tell them to just use :active.  ^_^

Although :active generally only matches while the mouse button is down so
styling 'on click' as in 'this rule will match from the first click on this
element' is not really possible e.g. a transition that begins on :active
will only last for as long as the mouse button is down. I'm suspecting that
what is being requested here is really an equivalent to the onclick event.

Received on Monday, 7 February 2011 18:23:40 UTC