If you have not read the css wizardry wiki page, I recommend it.
But one short answer is...
in the html you have code that looks like this.
<input class="sheet-testCloseChecked sheet-hidden" name="attr_Hide-Spells-Tab" type="checkbox" value="1"/>
<span class="sheet-HideIfCloseChecked">
whatever ... </span>
and in the css you have code that looks like this.
.sheet-testCloseChecked:checked+.sheet-HideIfCloseChecked,
.sheet-testCloseChecked:not(:checked)+.sheet-HideIfNotCloseChecked,
.sheet-testChecked:checked~.sheet-HideIfChecked,
.sheet-testChecked:not(:checked)~.sheet-HideIfNotChecked,
.sheet-testChecked:checked~div>.sheet-HideIfChecked,
.sheet-testChecked:not(:checked)~div>.sheet-HideIfNotChecked,
.sheet-testChecked:checked~div>div>.sheet-HideIfChecked,
.sheet-testChecked:not(:checked)~div>div>.sheet-HideIfNotChecked,
.sheet-testChecked:not(:checked)~.sheet-table-row>.sheet-HideIfNotChecked,
.sheet-hidden {
display: none;
}
The difference of course is that testCloseChecked paired with HideIfCloseChecked will only hide if the 2nd one is immediatly after the 1st. While the various testChecked HideIfChecked combo's will trigger if the Hide is anywhere after/inside the first.
Note also that checkboxes with the same name can appear multiple times in your character sheet, and some of them can be hidden. So in the code snippet above, you see that my "attr_Hide-Spells-Tab" is "sheet-hidden" which means that the user does not see that checkbox in that location of the character sheet. But it is right in front of the item that I want to sometimes be there, and sometimes not be there.
Also, the tested condition does not have to be a checkbox everywhere. You could have something that is a number or a select option in one place, but call it a checkbox where you want to do a test. so for example
<input class="sheet-testCloseChecked sheet-hidden" name="attr_WeirdTest" type="checkbox" value="Bob"/>
will test as checked only when WeirdTest is equal to "Bob".