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.

Quick-add: + add another resource

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.

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.

            
              <nav class="desktop">
  <a href="#">Desktop 1</a>
  <a href="#">Desktop 2</a>
  <a href="#">Desktop 3</a>
  <a href="#">Desktop 4</a>
</nav>

<nav class="mobile">
  <button>Toggle</button>
  <div>
    <a href="#">Mobile 1</a>
    <a href="#">Mobile 2</a>
    <a href="#">Mobile 3</a>
    <a href="#">Mobile 4</a>
  </div>
</nav>

<article>
  <h1>Basic Hamburger Menu</h1>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro quasi sint error perspiciatis quis rem nisi reiciendis doloribus cumque aliquid molestiae quos sed ex commodi ad eveniet asperiores distinctio vero.
  </p>
</article>
            
          
!
            
              html
  height: 2000px;

.mobile
  display: none;
  position: fixed;
  width: 100%;
  top: 0;
  div
    display: none;
  button
    position: absolute;
    top: 15px;
    right: 15px;
    border: 0;
    text-indent: 200%;
    overflow: hidden;
    background: rgba(255,255,255,.8) url(https://i.imgur.com/vKRaKDX.png) center no-repeat;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-size: 80%;
    width: 30px;
    height: 30px;
    outline: none;
    transition: all 400ms ease;
    &.expanded
      transform: rotate(90deg);
      background-color: transparent;
      border: 0;
  a
    display: block;

a
  background: #eee;
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid #ddd;
  text-decoration: none;
  color: #222;
  font-weight: bold;
  &:hover, &:active, &:focus
    background: darken(#eee, 3%);

.desktop
  display: block;
  overflow: hidden;
  a
    width: 25%;
    float: left;
    border-right: 1px solid #ddd;
    box-sizing: border-box;
    &:last-child
      border-right: none;

article
  padding: 0 30px 15px;


@media (max-width: 800px)
  .mobile
    display: block;
  .desktop
    display: none;
            
          
!
            
              $('button').click(function() {
  $(this).toggleClass('expanded').siblings('div').slideToggle();
});
            
          
!
999px
Loading ..................

Console