title: Trying to create toggle for icon in NavBar using a checkbox
body: <p>I am trying to use a checkbox to make my font awesome icon trigger the menu icon to open and close the menu (which is how I want it to be design wise) when the screen is in mobile view.</p>
  <p>Thanks in advance for any help.</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>/*** General ***/
  
  * {
    font-family: 'Noto Serif SC', serif;
    margin: 0;
    padding: 0;
  }
  
  .bluepic {
    padding-top: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 400px;
    height: auto;
  }
  
  .contents1 {
    margin-top: 5vh;
    margin-bottom: 10vh;
  }
  
  a {
    text-decoration: none;
    color: black;
    margin: none;
    padding: none;
  }
  
  
  /*** Header ***/
  
  .header {
    margin-top: 20px;
    margin-bottom: 20px;
  }
  
  .logo {
    text-align: center;
    font-size: 30px;
  }
  
  
  /*** Navigation ***/
  
  .fa-bars {
    display: none;
  }
  
  .nav-links {
    width: 100%;
    float: left;
    position: sticky;
    align-items: center;
    justify-content: center;
    padding: 0;
    background-color: #f7f7f7;
    border-bottom: 1px solid rgb(228, 224, 224);
    display: flex;
  }
  
  .nav-links li {
    list-style: none;
    text-align: center;
    font-size: 18px;
    float: left;
    padding: 14px 16px;
  }
  
  .nav-links li a {
    text-decoration: none;
    text-align: center;
    float: left;
  }
  
  
  /*** Footer ***/
  
  .footer {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 50%;
    text-align: center;
  }
  
  .footer2 {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 50%;
    text-align: center;
  }
  
  
  /*** Media Queries ***/
  
  @media only screen and (max-width: 800px) {
    .bluepic {
      padding-top: 10px;
      display: block;
      margin-left: auto;
      margin-right: auto;
      width: 100%;
      max-width: 375px;
      height: auto;
    }
  }
  
  @media only screen and (max-width: 700px) {
    .bluepic {
      padding-top: 10px;
      display: block;
      margin-left: auto;
      margin-right: auto;
      width: 100%;
      max-width: 350px;
      height: auto;
    }
  }
  
  @media only screen and (max-width: 600px) {
    .fa-bars {
      font-size: 20px;
      display: block;
      float: right;
      margin-top: 10px;
      margin-right: 40px;
      cursor: pointer;
    }
    .logo {
      text-align: left;
      font-size: 25px;
    }
    .nav-toggle {
      display: none;
    }
    .nav-links,
    ul {
      position: fixed;
      width: 100%;
      height: 100vh;
      text-align: center;
      background-color: #f7f7f7;
      border-bottom: 1px solid rgb(107, 76, 76);
      top: 80px;
      left: 0;
      flex-direction: column;
      display: none;
    }
    .nav-toggle:checked+.nav-links,
    ul {
      display: flex;
    }
    .nav-links li {
      display: block;
    }
    .contents1 {
      margin-top: 5vh;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link rel="preconnect" href="https://fonts.googleapis.com"&gt;
  &lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&gt;
  &lt;link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@200&amp;display=swap" rel="stylesheet"&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"&gt;
  
  &lt;div class="header"&gt;
    &lt;div&gt;
      &lt;div class="logo"&gt;
        &lt;h4&gt;The Blue Lion &lt;i class="fas fa-bars" id="nav-toggle"&gt;&lt;/i&gt;&lt;/h4&gt;
          &lt;input type="checkbox" id="nav-toggle" class="nav-toggle"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;label for="nav-toggle" class="nav-toggle-label"&gt;
      &lt;span&gt;&lt;/span&gt;
    &lt;/label&gt;
  &lt;/div&gt;
  
  &lt;div class="navbar"&gt;
    &lt;div class="nav-links" id="myTopnav"&gt;
      &lt;ul&gt;
        &lt;li a href="#"&gt;Food&lt;/li&gt;
        &lt;li a href="#"&gt;Drink&lt;/li&gt;
        &lt;li a href="#"&gt;Covid-19&lt;/li&gt;
        &lt;li a href="#"&gt;News&lt;/li&gt;
        &lt;li a href="#"&gt;Join the Team&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="contents1"&gt;
    &lt;img src="https://mcdn.wallpapersafari.com/medium/84/3/pQuUz4.jpg" class="bluepic" alt="Blue"&gt;
  &lt;/div&gt;
  
  &lt;div class="footer"&gt;
    &lt;div class="info"&gt;
      Leave us a review:
      &lt;i class="fab fa-tripadvisor"&gt;&lt;/i&gt;
    &lt;/div&gt;
  
    &lt;div class="socialiconsf"&gt;
      &lt;i class="fab fa-facebook-f"&gt;&lt;/i&gt;
      &lt;i class="fab fa-twitter"&gt;&lt;/i&gt;
      &lt;i class="fab fa-instagram"&gt;&lt;/i&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="footer2"&gt;
    &lt;p&gt;
      © The Blue Lion 2021
    &lt;/p&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>