W3C home > Mailing lists > Public > www-style@w3.org > December 2015

Re: CSS events

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 16 Dec 2015 10:36:15 -0800
Message-ID: <CAAWBYDAwPR41=muBgEAn+EaOLB_qmjMHCZG_TfBfg3Jg5OZkbQ@mail.gmail.com>
To: Nicolas Duclos <dunic777@hotmail.com>
Cc: www-style list <www-style@w3.org>
On Mon, Dec 14, 2015 at 4:04 PM, Nicolas Duclos <dunic777@hotmail.com> wrote:
> Click event :
>
> Could allow to make dropdown menu (mobile) or sub-menu animation. Could also
> allow to modify Something on the page itself.
>
> Example :
>
> .class :click{
>                 Color : blue;
> }
>
> So this could allow us to change the font color to blue if you click on this
> class, span, etc. Could also work with a navigation like if you click on
> this item, it will open it and you could add the normal transition. Also
> could be great to make some kind of Spoiler tag. <spoiler>.

This is difficult to do well in CSS, for the reasons I outline in
<https://tabatkins.github.io/specs/css-toggle-states/#checked-problems>.

You might want to look up the "checkbox hack"
<https://css-tricks.com/the-checkbox-hack/>, as it gives you similar
abilities without JS.  It just requires some additional HTML to
support it.

~TJ
Received on Wednesday, 16 December 2015 18:37:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:59 UTC