I was trying to make a css only clicking navigation system using checkboxes and labels. I never played much around labels and checkboxes other than what they're meant to be used for by the w3c. This is the minimal code I managed to put this into:
.bar{
list-style-type:none;
}
.bar ul{
display:none;
}
.bar input[type=checkbox]{
display:none;
}
label:hover{
cursor:pointer;
}
input[type=checkbox]:checked + label{
color:blue;
}
input[type=checkbox]:checked + ul{
display:inline;
}
<nav>
<ul class=bar>
<li>
<input type=checkbox id=1><label for=1>about</label>
<ul>
<li>us
<li>you
<li>cheese
</ul>
</ul>
</nav>
By clicking on "about" you can see that the label successfully turns blue, but the ul
right below it in the code doesn't get it's inline
display, it stays with a display of none as specified on the 4th line of css, which I used to hide the tabs by default.
What did I do wrong?