title: Pseudo and Adjacent Sibling Selectors
body: <p>I am trying to get my menu to display when my toggle checkbox is selected however, it will not. I understand why in that my .menu-container is not a sibling of my toggle element however, I do not know how to get it to work without taking my toggle out of the div so my .menu-container directly proceeds. I am still learning Javascript (I am junior) so understand this could be done with that but CSS is the way forwards for me at the moment unless you have a simple explanation/solution with js.</p>
  
  <p>I hope that makes sense.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  a {
    text-decoration: none;
  }
  
  .nav-container {
    position: fixed;
    top: 0;
    width: 100vw;
    /*border: 1px solid red;*/
  }
  
  .toggle-container {
    display: flex;
    justify-content: flex-end;
    /*border: 1px solid blue;*/
    /*margin: 20px;*/
  }
  
  .menu-container {
    display: flex;
    justify-content: flex-end;
    margin: 20px 30px 20px 20px;
  }
  
  .menu-item {
    padding: 0 10px;
    font-size: 1.1em;
  }
  
  #toggle {
    display: none;
  }
  
  .toggle {
    display: none;
    font-size: 1.8em;
    padding: 15px 30px 10px 0;
  }
  
  
  /*.menu-container {
      display: flex;
      flex-direction: column;
      border: 1px solid green;
      align-items: center;
  }
  */
  
  @media only screen and (max-width: 500px) {
    .toggle {
      display: block;
    }
    .menu-container {
      flex-direction: column;
      margin: 0;
      border-top: 1px solid gray;
      display: none;
    }
    .menu-item {
      padding: 8px;
      width: 100vw;
      text-align: center;
      border-bottom: 1px solid gray;
    }
    #toggle:checked+.menu-container {
      display: block;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;title&gt;Bundles&lt;/title&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;meta http-equiv="X-UA-Comptible" content="ie=edge"&gt;
    &lt;link rel="stylesheet" type="text/css" href="mynavtext.css"&gt;
    &lt;link rel="stylesheet" href="..\fontawesome-free-5.12.1-web\css\all.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
    &lt;nav class="nav-container"&gt;
  
      &lt;div class="toggle-container"&gt;
        &lt;label class="toggle" for="toggle"&gt;&lt;i class="fas fa-bars"&gt;&lt;/i&gt;&lt;/label&gt;
        &lt;input type="checkbox" id="toggle"&gt;
      &lt;/div&gt;
  
      &lt;div class="menu-container"&gt;
        &lt;a class="menu-item" href="#"&gt;Categories&lt;/a&gt;
        &lt;a class="menu-item" href="#"&gt;How It Works&lt;/a&gt;
        &lt;a class="menu-item" href="#"&gt;Log In&lt;/a&gt;
        &lt;a class="menu-item" href="#"&gt;Register&lt;/a&gt;
      &lt;/div&gt;
  
    &lt;/nav&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you,</p>