cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

            
              <input hidden aria-hidden="true" type="checkbox" name="toggle-nav" id="toggle-id"/>
<aside>
  <header role="banner">
    <nav>
      <label for="toggle-id">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
          <path d="M2,2L18,18M18,2L2,18"/>
        </svg>
        Close Menu
      </label>
    </nav>
  </header>
  <ul>
    <li><a href="#">Option</a></li>
    <li><a href="#">Stuff</a></li>
    <li><a href="#">Nonsense</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Help</a></li>
  </ul>
</aside>
<main>
  <header role="banner">
    <nav>
      <label for="toggle-id">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
          <path d="M2,2l16,0m-16,8l16,0m-16,8l16,0"/>
        </svg>
        Menu
      </label>
      <b>Logo</b>
    </nav>
  </header>
  <article>
    <h1>The main title</h1>
    <p>Sometimes you don't even need JavaScript to do the core interactive functionality of your website. Sometimes just CSS is more than enough, when you understand how it really works.</p>
    <p>For more details about this feel free to read the accompanying post on <a href="http://darksnow.net/code/off-canvas-without-javascript">my blog</a>.</p>
  </article>
</main>
    
            
          
!
            
              $menu-width: 200px;

body {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size: 1rem;
  line-height: 1.618em;
}

html, body, main {
  height: 100%;
}

aside {
  position: fixed;
  height: 100%;
  z-index: 1;
  background: #333;
  width: $menu-width;
  overflow-x: hidden;
}

main {
  z-index: 2;
  background: white;
  position: fixed;
  transition: transform 1s;
  overflow-y: auto;
}
article {
  padding: 1em;
}

header {
  background: #39f;
  padding: 0.5em 1em;
}
nav {
  display: flex;
  b {
    flex-grow: 1;
    text-align: right;
  }
}
svg {
  height: 1em;
  vertical-align: middle;
}
path {
  stroke: black;
  stroke-width: 3;
}
h1 {
  font-size: 2em;
  font-weight: bold;
}
p {
  margin-top: 1em;
}
a {
  color: #ff8133;
  font-weight: bold;
  text-decoration: none;
}
ul {
  padding: 1em;
}
/* Since all labels for the for attribute are
 * clickable, make them look like they are. */
label[for] {
  cursor: pointer;
}
/* Make sure the hidden checkbox is really hidden
 * from all consumers of this content. */
input[hidden] {
  display: none;
  &:checked ~ main {
    transform: translateX($menu-width);
  }
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console