I tried to change the nav element left property to zero when I checked the check box using CSS.
#check:checked ~ header nav{
left:0;
}
But any changes don't happen when I click the checkbox. Is it because the nav and checkbox are not siblings? Then how to recorrect it?
Here is the HTML code.
<body>
<div class="headernnav">
<header>
<div class="headertitle">EVERGREEN GRASS SUPPLIERS</div>
<input type="checkbox" id="check"></input>
<label for="check" class="checkbtn">
<i class="fas fa-bars"></i>
</label>
</header>
<nav>
<div class="firstitem"><a href="home.html" class="anav active">HOME</a></div>
<div class="item"><a href="aboutus.html" class="anav">ABOUT US</a></div>
<div class="item"><a href="gallery.html" class="anav">GALLERY</a></div>
<div class="item"><a href="shop.html" class="anav">SHOP</a></div>
<div class="lastitem"><a href="contactus.html" class="anav">CONTACT US</a></div>
</nav>
</div>
</body>
Please Can anyone offer some assistance to solve this problem? Thank you!