DEV Community

loading...

Discussion on: 3 Cool CSS Tricks to Impress Your Friends at Parties

Collapse
phantas0s profile image
Matthieu Cneude

Good tips! Thanks for that!

I wanted a show-on-click (third trick) for my blog, a while ago. My problem was: I wanted multiple show-on-click on one page.

The only solution I found was to give different ID for each hidden block / checkbox. Here's an example, in case somebody wanted to do the same thing: codepen.io/phantas0s/pen/dyGWLEb

Collapse
sharpseeer profile image
Aaron Throckmorton

If you nest the input element inside the label you don't need the for attribute anymore and the two are automatically linked. In theory, ymmv.

Collapse
phantas0s profile image
Matthieu Cneude

Ooh. That's a good idea. Thanks for that.