I encountered a problem while doing the project.
why not run #MyId:checked~#show
(style) for ID
of a tag in <a>
, <label>
and <p>
is there a way to run css
for it?
without removing and moving the label tag
, change the #test:checked~#show
of this example to run properly.
#show {
display: none;
}
#test:checked~#show {
display: block;
}
<label>
<input id="test" type="radio" value="0">click to show
</label>
<div id="show">
hahahahahahha
</div>
Otherwise you can do that:
#show {
display: none;
}
#test:checked~#show {
display: block;
}
<input id="test" type="checkbox" >
<label for="test">click to show</label>
<div id="show">
hahahahahahha
</div>