
I need to hide a whole bunch of sections and give each one a checkbox control to reveal it.
This worked for the first one:
html:
<input style="width:10px;" type="checkbox" class="sheet-toggle-show" />Name-of-section
<div class="sheet-body">
Section-to-be-hidden
</div>
CSS:
input.sheet-toggle-show:not(:checked) ~ div.sheet-body,
input.sheet-toggle-hide:checked ~ div.sheet-body {
display: none;
}
However, when I come to do the same for the second section (using identical html to that shown above) the checkbox control for the second hidden section will only work if the checkbox for the first hidden section is already ticked. If the first checkbox is ticked then the second hidden section cannot be revealed.
Where have I gone wrong with this?