Yes, this is possible with pure CSS. You're able to click on an element by making use of a checkbox's :checked attribute in combination with a element's for
attribute.
Because the checkbox can be unchecked, you can use this to toggle visibility by simply adding visibility: hidden
to an element stemming from :checked
(once the checkbox is clicked again, this pseudo-selector will be invalid, and the CSS selector will no longer match the target).
This can be extended to a
with use of the for
attribute, so that you can completely hide the checkbox itself, and apply your own styling to the
directly.
The following makes use of the adjacent sibling combinator (+) to toggle the class toggle
when the
element is clicked: