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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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
Loading ..................

Console