Re: :click pseudo element

On Jan 29, 2011, at 2:19 PM, thomasin a 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. 


1) :hover is a pseudo class, not a pseudo element.
2) Pseudo classes (in general) reflect some state or attribute of the element that isn't otherwise (easily/reliably) detectable in CSS. Pseudo elements represent some structure of the document that isn't part of the DOM.
3) Being hovered over is a state, a click is an event.

There is the :active pseudo class which may well apply while something is being clicked on (provided a click "activates" it, which is not defined by CSS currently, though there was work in this direction a while back).

Having said all that, while a :click pseudo class doesn't really work (neither does a ::click pseudo element), there are use cases for triggering transitions and animations on events. We've discussed this also in the past but haven't gotten any good answers yet.

Peter

Received on Tuesday, 8 February 2011 01:42:56 UTC