I want to show/hide divs with ONLY css radio buttons. When group1 is checked I want the "test class" to change. This works fine when i remove the nav-bar div, but I need that for test purposes. Can i still use the "checked" for different level divs. i have tested with all > + and ~ but this doesnt work. please help.
.bingo-box-container {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.bingo-box {
display: flex;
flex-direction: column;
width: 30%;
margin: 30px 0px;
position: relative;
background-color: #000;
}
.bingo-box-img img {
width: 100%;
height: 100%;
}
.bingo-box-text {
font-size: 40px;
line-height: 1;
color: #fff;
position: absolute;
top: 50%;
}
.bingo-box-text h2 {
color: #fff;
font-size: 40px;
line-height: 1;
}
.bingo-box-text p {
font-size: 20px;
}
.i-icon {
position: absolute;
top: 0;
right: 0;
font-size: 80px;
background: #fff;
border: 1px solid black;
width: 30px;
height: 40px;
}
.hover-it {
opacity: 0;
}
.i-icon:hover~.hover-it {
opacity: 1;
}
.i-icon:hover~.bingo-box-img {
opacity: 0.5;
background: #000;
}
.i-icon:hover .bingo-box {}
.bingo-box-cta {
background: #fff;
}
input {
display: none;
}
.bingo-box {
display: none;
}
#group1:checked~.bingo-box-container .test,
#group1:checked+.bingo-box-container .test,
#group1:checked>.bingo-box-container .test {
display: block;
}
label {
background: red;
width: 100px;
display: blo
}
<div class="bingo-box-wrapper">
<div class="nav-bar">
<label for="group1"> group one</label>
<label for="group2"> group two</label>
<input id="group1" name="group" type="radio" />
<input id="group2" name="group" type="radio" />
</div>
<div class="bingo-box-container">
<div class="bingo-box">
<div class="bingo-box-img">
<img alt="" src="/library/2021/promotions/winners/large-2021_06_TypoKaraStepNow.jpg" />
</div>
<div class="bingo-box-cta">
<a class="btn action btn_type_extended-real-play" href="/promotions/welcome-offer" target="_self">More Info</a>
</div>
</div>
<div class="bingo-box test">
<div class="bingo-box-img">
<img alt="" src="/library/2021/promotions/may/winners/big.jpg" />
</div>
<div class="bingo-box-cta">
<a class="btn action btn_type_extended-real-play" href="/promotions/welcome-offer" target="_self">More Info</a>
</div>
</div>
<div class="bingo-box">
<div class="bingo-box-img">
<img alt="" src="/library/2020/winners/20aug/sambud12_yellow.jpg" />
</div>
<div class="bingo-box-cta">
<a class="btn action btn_type_extended-real-play" href="/promotions/welcome-offer" target="_self">More Info</a>
</div>
</div>
<div class="bingo-box test">
<div class="bingo-box-img">
<img alt="" src="/library/2021/promotions/winners/large-2021_06_TypoKaraStepNow.jpg" />
</div>
<div class="bingo-box-cta">
<a class="btn action btn_type_extended-real-play" href="/promotions/welcome-offer" target="_self">More Info</a>
</div>
</div>
<div class="bingo-box">
<div class="i-icon">
</div>
<div class="bingo-box-img">
<img alt="" src="/library/2021/promotions/winners/large-2021_06_TypoKaraStepNow.jpg" />
</div>
<div class="bingo-box-text hover-it">
<h2>BINGO ROOM</h2>
<p>Info here</p>
<p>info here</p>
</div>
<div class="bingo-box-cta">
<a class="btn action btn_type_extended-real-play" href="/promotions/welcome-offer" target="_self">More Info</a>
</div>
</div>
<div class="bingo-box">
<div class="bingo-box-img">
<img alt="" src="/library/2022/promotion/test/Capture.PNG" />
</div>
<div class="bingo-box-text">
<h2>BINGO ROOM</h2>
<p>Info here</p>
<p>info here</p>
</div>
<div class="bingo-box-cta">
<a class="btn action btn_type_extended-real-play" href="/promotions/welcome-offer" target="_self">More Info</a>
</div>
</div>
</div>