<nav role="navigation">
  <div id="menuToggle"> 
    <!--
    hidden checkbox is used as click reciever,
    so you can use the :checked selector on it.
    -->
    <input name="toggle" type="checkbox" />
    <label for="toggle">
      <span>menu</span>
      <!--
      divs to be styled as a hamburger button
      -->
      <div></div>
      <div></div>
      <div></div>
    </label>

    
    <!--
    the menu that will slide in from the left
    -->
    <ul id="menu">
      <a href="#"><li>Home</li></a>
      <a href="#"><li>About</li></a>
      <a href="#"><li>Contact</li></a>
    </ul>
  </div>
</nav>
/* Base styles */
body {
  margin: 0;
  padding: 0;
  background: #232323;
  color: #cdcdcd;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji
}

#menuToggle {
  display: block;
  position: relative;
  top: 50px;
  left: 50px;  
  z-index: 1;  
  -webkit-user-select: none;
  -moz-user-select: none;
   -ms-user-select: none;
       user-select: none;
}

#menuToggle a {
  text-decoration: none;
  color: #232323;
  -webkit-transition: color 0.3s ease;
  -o-transition: color 0.3s ease;
  transition: color 0.3s ease;
}

#menuToggle a:hover {
  color: #4f7794;
}


/* The hamburger button hidden inside an input element */
#menuToggle input {
  display: block;
  width: 30px;
  height: 30px;
  position: absolute;
  top: -7px;
  left: -5px;  
  padding: 0;
  cursor: pointer;  
  opacity: 0; /* hide this */
  z-index: 2; /* and place it over the hamburger */  
  -webkit-touch-callout: none;
}

#menuToggle label {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
}
#menuToggle label span {
  display: none;
}

/*
 * Hamburger
 */
#menuToggle label div {
  display: block;
  width: 30px;
  height: 2px;
  margin-bottom: 6px;
  position: relative;
  background: #cdcdcd;
  border-radius: 3px;  
  z-index: 1;  
  -webkit-transform-origin: 4px 0px;  
      -ms-transform-origin: 4px 0px;  
          transform-origin: 4px 0px;
  -webkit-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

#menuToggle label div:first-child {
  -webkit-transform-origin: 0% 100%;
      -ms-transform-origin: 0% 100%;
          transform-origin: 0% 100%;
}

#menuToggle label div:nth-child(2) {
    -webkit-transform-origin: 0% 0%;
      -ms-transform-origin: 0% 0%;
          transform-origin: 0% 0%;
}

/* 
 * Change the color of the hamburger when toggled
 */
#menuToggle input:checked + label div {
  background: #232323;
}

/*
 * Use absolute positioning to place the menu off-screen
 */
#menu {
  position: absolute;
  width: 300px;
  margin: -100px 0 0 -50px;
  padding: 50px;
  padding-top: 125px;
  background: #ededed;
  list-style-type: none;
  /* Hide the menu off-screen to the left */
  left: -100%;
  -webkit-transition: left 0.3s ease;
  -o-transition: left 0.3s ease;
  transition: left 0.3s ease; 
}

#menu li {
  padding: 10px 0;
  font-size: 22px;
}

/*
 * Slide the menu in from left when the input is checked
 */
#menuToggle input:checked ~ ul {
  left: 0;
}
// Nothing

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.