title: Addressing issue with disappearing li elements in navbar (HTML, CSS, JS)
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.addEventListener("DOMContentLoaded", () =&gt; {
    let menuBtn = document.querySelector("#menu-button");
    let menu = document.querySelector("#menu");
    let menuItems = menu.getElementsByTagName("li");
  
    menuBtn.addEventListener("click", e =&gt; {
      if (e.target.innerText === ("✕")) {
        e.target.innerText = "☰";
        [...menuItems].forEach(item =&gt; item.style.display = "none");
      } else if (e.target.innerText === "☰") {
        e.target.innerText = "✕";
        [...menuItems].forEach(item =&gt; item.style.display = "block");
      }
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>  header {
    width: 100%;
    height: 100px;
  }
  
  #menu {
    display: flex;
    flex-direction: row;
    margin: 0 auto;
    justify-content: space-around;
    font-size: 2rem;
  }
  
  #menu-button {
    display: none;
  }
  
  li {
    list-style-type: none;
  }
  
  a {
    text-decoration: none;
    color: rgb(0, 0, 0);
  }
  
  @media screen and (max-width: 1050px) {
    #menu {
      flex-direction: column;
      width: 100%;
      height: 100%;
    }
    #menu li {
      padding: 1.5rem;
      display: none;
    }
    #menu-button {
      display: block;
      font-size: 3rem;
      cursor: pointer;
      outline: none;
      border: none;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;header&gt;
    &lt;nav&gt;
      &lt;button id="menu-button"&gt;☰&lt;/button&gt;
      &lt;ul id="menu"&gt;
        &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/nav&gt;
  &lt;/header&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>It's a simple nav menu with desktop-first approach that uses <code>flexbox</code>.</p>
  <ol>
  <li>Viewport is less than 1050px and therefore shows hamburger button</li>
  <li>Hamburger button is clicked to show menu in dropdown form. Hamburger button changes to &quot;X&quot;.</li>
  <li>&quot;X&quot; is clicked. The JS code changes all <code>li</code> elements to <code>display: none</code></li>
  <li>PROBLEM: Viewport is increased beyond breakpoint of 1050px. Since <code>li</code> elements were changed to <code>display: none</code>, menu is not shown.</li>
  </ol>
  <p>Would appreciate suggestions on how to address this.</p>
  <p>Also, smaller but nagging issue.</p>
  <ol>
  <li>Viewport is less than 1050px and therefore shows hamburger button</li>
  <li>Hamburger button is clicked to show menu in dropdown form. Hamburger button changes to &quot;X&quot;.</li>
  <li>Viewport is increased beyond breakpoint of 1050p and then back below breakpoint. Since all <code>li</code> elements were set to <code>display: block</code> in JS code, the dropdown menu appears. I'd like to make it so that the hamburger icon appears whenever viewport size is decreased.</li>
  </ol>
  <p>Thanks for all and any help!</p>