<div id="TopNavBar">
  <nav id="TopNavWrap">
    <button id="toggle" class="toggle"></button>
    <ul class="TopNavMain">
      <li><a href="https://www.hippoiathanatoi.com/">Home</a></li>
      <li><a href="https://www.hippoiathanatoi.com/Blog/">Blog</a></li>
      <li><a href="https://www.hippoiathanatoi.com/Logs/">Logs</a></li>
      <li><a href="https://www.hippoiathanatoi.com/Gallery/">Gallery</a></li>
      <li><a href="https://www.hippoiathanatoi.com/Reviews/">Reviews</a></li>
      <li><a class="sub" href="#">Elsewhere</a>
        <ul class="TopNavSub">
          <li><a href="https://www.hippoiathanatoi.com/Otherworldly/">Otherworldly</a></li>
          <li><a href="https://www.westeros.org/">Westeros</a></li>
        </ul>
      </li>
    </ul>
  </nav>
</div>

<p>Start content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
<p>Content to scroll</p>
html,
body {
  margin: 0;
  padding: 0;
}
#TopNavBar {
  position: fixed;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1001;
}
#TopNavWrap {
  background: #cc5c46;
  box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
  height: 2em;
  z-index: 1002;
  text-align: center;
}

ul.TopNavMain {
  list-style: none;
  position: relative;
  display: inline-table;
  margin: 0;
  padding: 5px 0 0 0;
  text-align: center;
}

ul.TopNavMain:after {
  content: "";
  clear: both;
  display: block;
}

ul.TopNavMain li {
  float: left;
  font: 120% "Uncial Antiqua", serif;
}
ul.TopNavMain li:hover > ul {
  display: block;
}
ul.TopNavMain li a {
  display: block;
  padding: 0px 10px;
  color: #f1d9b3;
  text-decoration: none;
}
ul.TopNavMain li a:hover {
  color: #f4e1c4;
  text-decoration: underline;
}
ul.TopNavMain ul {
  display: none;
  background: #000000;
  margin: 0;
  padding: 0;
  position: absolute;
  top: 100%;
  white-space: nowrap;
}
ul.TopNavMain ul li {
  float: none;
  font: 90% "Alegreya SC", serif;
  position: relative;
  text-align: left;
}
ul.TopNavMain ul li a {
  padding: 10px 10px 10px 10px;
  color: #f1d9b3;
  text-decoration: none;
}

ul.TopNavMain ul li a:hover {
  color: #f4e1c4;
  text-decoration: underline;
}
/* hamburger menu */
.toggle {
  display: none;
  position: absolute;
  z-index: 99;
  top: 7px;
  left: 10px;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
  width: 25px;
  height: 18px;
  border: none;
  border-top: 2px solid #fff;
  border-bottom: 2px solid #fff;
  text-decoration: none;
  color: #fff;
  outline: 0;
}
.toggle:before,
.toggle:after {
  content: "";
  display: block;
  width: 25px;
  height: 2px;
  top: 6px;
  left: 0;
  background: #fff;
  position: absolute;
}
.toggle,
.toggle:before,
.toggle:after {
  transition: all 0.3s ease;
  transform: rotate(0deg);
}
.open .toggle {
  border-color: transparent;
}
.open .toggle:before {
  transform: rotate(45deg);
}
.open .toggle:after {
  transform: rotate(-45deg);
}
@media screen and (max-width: 768px) {
  .toggle {
    display: block;
  }
  .top:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2.5em;
    background: #ccc;
    z-index: 98;
  }
  /* redo nav for smaller screen*/
  ul.TopNavMain {
    position: absolute;
    background: #cc5c46;
    top: 0%;
    width: 100%;
    left: -999rem;
    text-align: center;
    transition: top 0.5s ease, left 0s 0.5s, opacity 0.5s ease;
    opacity: 0;
    border-top: 1px solid #000;
  }
  .open ul.TopNavMain {
    left: 0;
    opacity: 1;
    top: 100%;
    transition: top 0.5s ease, left 0s 0s, opacity 0.5s ease;
  }

  ul.TopNavMain li {
    float: none;
    display: block;
    font-size: 1rem;
    text-align: center;
  }
  ul.TopNavMain li > ul {
    list-style: none;
    display: block;
    position: static;
    white-space: normal;
  }
  ul.TopNavMain li a {
    display: block;
    padding: 10px;
    color: #f1d9b3;
    text-decoration: none;
  }
  ul.TopNavMain li a:hover {
    background: red;
  }
  ul.TopNavMain li,
  ul.TopNavMain ul li {
    text-align: center;
    border-bottom: 1px solid #000;
  }
  ul.TopNavMain ul li a {
    padding: 10px;
    text-decoration: none;
    font-size: 1rem;
  }
  ul.TopNavMain ul li a:hover {
    color: #f4e1c4;
    background: red;
  }
  ul.TopNavMain li a.sub {
    display: none;
  }
}
(function (d) {
  "use strict";

  var myToggle = d.getElementById("toggle");
  var toggleParent = d.getElementById("TopNavBar");

  myToggle.addEventListener(
    "click",
    function () {
      toggleParent.classList.toggle("open");
    },
    false
  );
})(document);
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.