Comment
Comment by grishka
Another way is to use the checkbox-and-CSS trick. You add a hidden checkbox next to the element you want to hide, add a label to trigger the checkbox, and then use a + selector to toggle the visibility based on the state of the checkbox. Like this:
You can also use a variation of this for tabs - just use radio buttons instead - and accordions.