DEV Community

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

Collapse
 
vtrpldn profile image
Vitor Paladini • Edited

Hey, that was a great question. You are almost right, instead of changing classes you'd need to change the id and the for attribute of each label. Here's an example: codepen.io/vtrpldn/pen/WNrZzvd

Collapse
 
prkr32 profile image
prkr32

Wow, thanks so much! This works because the + example always opens the nearest .example, so we don't have to identify the different .examples by changing their class, right? Just weird to me that the id for the different checkboxes are now unique, but we don't have to change any of the CSS to reflect that uniqueness.