So I want to make a container hidden but when the checkbox is checked I want it to be visible, only HTML/CSS, Is it possible?
.imgs-container {
display: grid;
justify-content: stretch;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
#app:checked ~ .imgs-container {
display: none;
}
<body>
<label for="#app">App</label>
<input type="checkbox" name="app" id="#app" />
<div class="imgs-container">
<div class="img-box">
<img src="/img/d1.jp" alt="image" />
<div class="text">
<h4>Awesome image</h4>
<p>Photography</p>
</div>
</div>
</div>
</body>
2
Answers
My code is right, the problem was the Hash in the
<input id="#app">
Remove
#
fromfor
and fromid
.Also invert your selector with
:not(:checked)