Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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

              
                <nav role='navigation'>
  <input type="checkbox" id="nav-toggle"/>
  <label for="nav-toggle">&equiv;</label>
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Clients</a></li>
    <li><a href="#">This is a really long link that wraps</a></li>
  </ul>
  <div class="clearfix"></div>
</nav>





<p>This is some content below the nav. Notice it gets pushed as it should.</p>

              
            
!

CSS

              
                @import "lesshat";

/* basic functionality */
nav ul {
  width: 250px;
  max-height: 0;
  transition: max-height 1s linear -1s;
}

nav input:checked ~ ul {
  max-height: 10000px;
  transition: max-height 0.8s linear;
}

nav ul li {
  width: 100%;
  display: block;
}
// closed state
nav ul li {
  max-height: 0;
  overflow: hidden;
  transition: max-height ease-in 0.5s;
}

// open state  
nav input:checked ~ ul li {
  max-height: 4rem; // extra for text wrap
}





// stylistic choice
body {
  background-color: #232323;
  color: darken(white, 30%);
  font-family: 'Arial', 'Helvetica', sans-serif;
  font-weight: lighter;
}
nav {
  
  input {
    outline: none;
    display: none;
    .appearance(none);
  }
  
  label {
    color: transparent;
    position: relative;
    display: inline-block;
    z-index: 2;
    height: 0;
    width: 0;
    padding: 2rem;
    background-color: darken(white, 95%);
    margin-left: 0.4rem;
    float: left;
  }
  
  label::before {
    display: inline-block;
    color: darken(white, 50%);
    font-size: 4rem;
    content: "\2295";
    text-align: center;
    .rotateZ(180deg);
    .transform-origin(52% 52%);
    .transition(transform linear 0.3s);
    position: absolute;
    left: 10%;
    top: -10%;
  }
  
  input:checked + label::before {
    .rotateZ(45deg);
  }
  
  
  ul {
    /* width: 0px; */
    padding: 0;
    background-color: darken(white, 95%);
    margin: 0rem;
    float: left;
    .transition(all linear 0.3s);
    
    li {
      list-style: none;
      margin: 0;
      
      a {
        display: block;
        color: darken(white, 50%);
        text-decoration: none;
        padding: 0.5rem;
        background-color: black;
        margin: 0.25rem;
        
        &:hover {
          background-color: darken(grey, 40%);
        }
      }
    }
  }
  
  input:checked ~ ul {
    /* width: 200px; */
    /* padding: 1rem; */
    /* margin: 0 0 0 0.4rem; */
  }
  
  .clearfix {
    clear: both;
    display: block;
    width: 100%;
    height: 0;
    line-height: 0;
    font-size: 0;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console