Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <header class="header">
  <div class="hamburger">
    <div class="hamburger-box">
      <div class="hamburger-inner"></div>
    </div>
  </div>
</header>
<nav class="navbar" role="navigation">
  <ul class="menu">
    <li class="menu-item"><a href="#">menu item</a></li>
    <li class="menu-item"><a href="#">menu item</a></li>
    <li class="menu-item"><a href="#">menu item</a></li>
    <li class="menu-item"><a href="#">menu item</a></li>
  </ul>
</nav>
<div class="backdrop"></div>

<main class="main">
  <h1 class="main-title">My awesome menu</h1>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Officiis, autem mollitia? Rem tenetur sequi dolorem quis ab libero possimus minima, consequuntur repudiandae quibusdam. Voluptatibus facere mollitia, iure qui minima aut numquam enim ipsum quis laboriosam obcaecati quasi a, et voluptatum.</p>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum, cum voluptatum vel recusandae, doloribus necessitatibus, aspernatur doloremque corporis labore perspiciatis libero ipsam? Fugit commodi omnis culpa, voluptates odit earum nisi hic nostrum nesciunt ut nihil labore rerum, unde ratione asperiores optio soluta ducimus error dolorem accusamus. Vel dolores nostrum, a quas deleniti totam perspiciatis, ab voluptatem maiores in eos sint incidunt? Repellendus nam ab veniam iste, omnis veritatis impedit quos earum, quibusdam velit aspernatur ipsum! Veniam optio tempora iusto omnis autem nobis voluptas officia placeat ea, sunt ratione asperiores repellendus qui facilis, exercitationem cumque non perferendis vero. Repellat, perferendis? Nam.</p>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid temporibus sed est quo sequi, quae accusantium quidem harum deleniti culpa, minima tempore dolor? Illum, enim eos? Assumenda minus sint excepturi harum enim fugiat possimus. Obcaecati voluptatum sequi quis minima. Odio officiis ullam dolore, doloribus incidunt vero corporis aliquid, animi dolor dolorum ipsam ea alias omnis voluptatem inventore laborum quam a. Quam earum distinctio blanditiis minima magni saepe molestias perferendis sit inventore expedita, autem consectetur, quidem quod dignissimos dicta doloremque? Reiciendis, fugiat deserunt rerum voluptate temporibus rem soluta quaerat? Recusandae laborum voluptate possimus temporibus provident inventore architecto distinctio sit assumenda nobis.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia cum illum nobis quos facilis, beatae laborum eaque dolorem, fugiat neque, veniam ipsa? Fuga atque doloremque dolorum, explicabo animi porro tempora nulla sit molestias magnam est voluptatibus ratione dicta minima repellendus quas! Veritatis vel tenetur debitis, eos nesciunt vero laudantium numquam dolorum unde maxime, excepturi deleniti velit corporis eius aliquam nobis possimus non nisi illo dolor animi nihil quidem incidunt. Mollitia voluptate at voluptates rem maiores ad sunt eos assumenda obcaecati. Laudantium labore fugiat, perferendis magni eum harum reiciendis nam autem totam natus cumque dolore amet sint soluta et! Cum, laboriosam.</p>
</main>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Lato");
html {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  -ms-box-sizing: border-box;
  box-sizing: border-box;
  font-family: "Lato", sans-serif;
  line-height: 1.15; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
  -ms-text-size-adjust: 100%;
  -ms-overflow-style: scrollbar;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  /* Font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

*,
*::before,
*::after {
  -webkit-box-sizing: inherit;
  -moz-box-sizing: inherit;
  -ms-box-sizing: inherit;
  box-sizing: inherit;
  margin: 0;
  padding: 0;
  border: 0;
}

body {
  color: #fff;
  background-color: #282c34;
  overflow: hidden;
  transition: transform 300ms ease-in-out;
}

a {
  text-decoration: none;
  color: inherit;
  text-transform: uppercase;
}

.header {
  background-color: #fff;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transform: translate3d(-100%, 0, 0);
  height: 100vh;
  width: 300px;
  background-color: #fafafa;
  transition: 0.1s ease-in;
  overflow-y:auto;
}

.main {
  text-align: justify;
  margin: auto;
  max-width: 80%;
}

.main {
  padding: 10px;
}

.main-title {
  text-align: center;
}

.open {
  transform: translate3d(0, 0, 0);
  transition: 0.05s;
}

.menu {
  color: #333;
}

.menu-item {
  display: block;
  margin-top: 1rem;
  padding-top: 10px;
  padding-left: 10px;
}

.hamburger {
  padding: 15px 15px;
  display: inline-block;
  cursor: pointer;
  transition-property: opacity, filter;
  transition-duration: 0.15s;
  transition-timing-function: linear;
  font: inherit;
  color: inherit;
  text-transform: none;
  background-color: transparent;
  border: 0;
  margin: 0;
  overflow: visible;
}
.hamburger:hover {
  opacity: 0.7;
}
.hamburger.is-active:hover {
  opacity: 0.7;
}
.hamburger.is-active .hamburger-inner,
.hamburger.is-active .hamburger-inner::before,
.hamburger.is-active .hamburger-inner::after {
  background-color: #000;
}

.hamburger-box {
  width: 40px;
  height: 24px;
  display: inline-block;
  position: relative;
}

.hamburger-inner {
  display: block;
  top: 50%;
  margin-top: -2px;
}
.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
  width: 40px;
  height: 4px;
  background-color: #000;
  border-radius: 4px;
  position: absolute;
  transition-property: transform;
  transition-duration: 0.15s;
  transition-timing-function: ease;
}
.hamburger-inner::before,
.hamburger-inner::after {
  content: "";
  display: block;
}
.hamburger-inner::before {
  top: -10px;
}
.hamburger-inner::after {
  bottom: -10px;
}

.translate {
  transform: translate3d(300px, 0, 0);
}

.backdrop {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: 0.15s ease-in-out;
  z-index: -1;
  pointer-events: none;
}

.backdrop.show {
  pointer-events: auto;
  opacity: 1;
  z-index: 100;
}

              
            
!

JS

              
                !(function(w, d){
  const navbar = d.querySelector('.navbar')
  const body = d.body
  const toggle = d.querySelector('.hamburger')
  const backdrop = d.querySelector('.backdrop')
  toggle.addEventListener('click', () =>{
    body.classList.toggle('translate')
    backdrop.classList.toggle('show')
  })
  
  backdrop.addEventListener('click', function(e){
    if(e.target === this){
         body.classList.toggle('translate')
        backdrop.classList.toggle('show')
    }
  })
})(window, document)
              
            
!
999px

Console