<ul class="menu" id="menu">
    <li><a href="#">Home</a></li>
    <li><a href="#">Profile</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contacts</a></li>
    <a class="close" href="#">
      <span class="material-icons">
        close
      </span>
    </a>
  </ul>
  <a class="hamburger" href="#menu">
    <span class="material-icons">
      menu
    </span>
  </a>
* {
  margin: 0;
  box-sizing: border-box;
}

.hamburger {
  position: fixed;
  /* a large z-index puts the ham button above the rest of the page*/
  z-index: 99;
  background: white;
  border: none;
  color: black;
  cursor: pointer;
  top: 1rem;
  right: 1rem;
}

.menu {
  position: fixed;
  /* give the menu a larger z-index than the ham link
  to put the menu above it */
  z-index: 100;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  /* basic menu styling*/
  list-style: none;
  background: black;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3rem;
  /* animate slide up/down */
  transform: translateY(-100%);
  transition: transform 0.2s ease;
}

.close {
  position: absolute;
  border: none;
  color: white;
  cursor: pointer;
  top: 1rem;
  right: 1rem;
}

.menu:target {
  /* show menu */
  transform: translateY(0);
}

li {
  padding: 1rem 0;
}

li a {
  color: white;
  font-size: xx-large;
  text-decoration: none;
}

li a:hover {
  text-decoration: underline;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.