I can't get sibling selectors to work in my navbar

I am trying out a responsive navbar, where the menu icon is a checkbox, and when “checked” it is supposed to toggle it’s next sibling, which is the ul.
But it is not working and I am not sure what I overlooked.
I have the whole thing here on codepen if someone would be so kind to help me out.

i think you overlooked the display declaration, happens to the best of us :wink:

.nav .menu-btn:checked ~ .menu {
    max-height: 440px;
    display: block; /*this is what you missed*/
    /*this is  for adjusting the style */
    position: relative;

hope that helps


Ah yes of course!
Thank you :grin:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.