How to target the sibling of the parent from a child? I'm trying to make a pure css hamburger menu and i have this checkbox input inside a label where it's :before content is a trigram.
on desktop view the ul list is displayed block and none on mobile. Now the show and hide is working when the ul is a direct sibling of the input box, the tilde selector works.
However what i wanted to do is take out the ul inside the label to be it's own sibling so the input is the only child left of the label. With the ul out, the show and hide doesn't work anymore.
how do i target the ul when the input is checked?
HTML:
<nav>
<label class="nav-toggler">
<input type="checkbox" />
</label>
<ul class="nav-links">
<li>link</li>
<li>link</li>
<li>link</li>
</ul>
</nav>
SCSS:
.nav-toggler{
&:before{
content:'\2630';
}
input{
opacity: 0;
width: 0;
height: 0;
&:checked ~ .nav-links{
display: block;
}
}
}