I am able to get this code to work:
[data-field-name="HideAndShow"] {
opacity: 0;
max-height: 0;
overflow: hidden;
}
input[id="UniqueCheckbox"]:checked ~ [data-field-name="HideAndShow"] {
opacity: 1 !important;
max-height: 100px !important;
overflow: visible !important;
display: block !important;
}
<input id="UniqueCheckbox" type="checkbox">
<label>Click to show</label>
<div data-field-name="HideAndShow">
Hide and Show This
</div>
In the application I am trying to style it has the input inside the label and I cannot get it to work:
[data-field-name="HideAndShow"] {
opacity: 0;
max-height: 0;
overflow: hidden;
}
input[id="UniqueCheckbox"]:checked ~ [data-field-name="HideAndShow"] {
opacity: 1 !important;
max-height: 100px !important;
overflow: visible !important;
display: block !important;
}
<label><input id="UniqueCheckbox" type="checkbox">Click to show</label>
<div data-field-name="HideAndShow">
Hide and Show This
</div>
The application I am styling is very locked down and I cannot change it. Is there a way around this with the HTML structure locked in place? Ideally using only CSS.
Edit
I'm happy to consider jquery solutions.
Thank you,