Humberger Menu

by Kissy

HTML

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css">
  <div id="nav-drawer">
      <input type="checkbox" id="nav-input" class="nav-state">
      <label id="nav-opener" for="nav-input"></label>
      <label class="nav-background" id="nav-closer" for="nav-input"></label>
      <div id="nav-content">
        <ul>
          <li>メニュー1</li>
          <li>メニュー2</li>
          <li>メニュー3</li>
        </ul>
      </div>
  </div>

CSS

#nav-drawer {
  position: relative;
  width: 100%;
  height: 2rem;
  background: SkyBlue;
}

.nav-state {
  display:none;
}

.nav-background {
  display:none;
}

#nav-opener {
  display: inline-block;
}

#nav-opener:before {
  display: block;
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  content: '\f0c9';
  cursor: pointer;
}

#nav-closer {
  display: none;
  position: fixed;
  z-index: 99;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  opacity: 0;
  transition: .3s ease-in-out;
}

#nav-content {
  overflow: auto;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 90%;
  max-width: 330px;
  height: 100%;
  background: White;
  transition: .3s ease-in-out;
  -webkit-transform: translateX(-105%);
  transform: translateX(-105%);
}

#nav-input:checked ~ #nav-closer {
  display: block;
  opacity: .5;
}

#nav-input:checked ~ #nav-content {
  -webkit-transform: translateX(0%);
  transform: translateX(0%);
  box-shadow: 6px 0 25px rgba(0,0,0,.15);
}