cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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 type="checkbox" role="button" title="menu" id="nav_check">
<label for="nav_check" id="burger" class="burger wrapper" aria-hidden="true" title="menu">
  <span class="burger box">
    <span class="burger inner"></span>
  </span>
</label>
<nav>
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Projects</a></li>
    <li><a href="#">Products</a></li>
    <li><a href="#">Company</a></li>
  </ul>
</nav>
<main class="main">
  <section id="content">
    <article>
    <h1>Sliding side menu with pure CSS</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis purus et ex luctus accumsan. Nulla maximus ac neque quis ultrices. Sed volutpat congue ipsum, quis vestibulum odio sodales et. Suspendisse vel posuere eros. Morbi faucibus nulla urna, id vehicula tortor posuere vitae. Donec non convallis neque. Donec id turpis sed metus lacinia vehicula.</p>
      
      <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
    </article>
  </section>
</main>

            
          
!
            
              // ******************************
// Normalize (ignore me!)
// ******************************
@import "compass";
@import "compass/css3";
@import url(//fonts.googleapis.com/css?family=Lato:300);
$fonts:Lato,Arial,"Hiragino Kaku Gothic Pro W3",Meiryo,sans-serif;
$bg_color:#333;
$font_color:#ccc;
$link_color:#ccc;
$link_hover_color:#aaa;

* {
  &:before,
  &:after{
    box-sizing:border-box;
    padding:0;
    margin:0;
  }
}
body{
  font-family:$fonts;
  color: $font_color;
  text-align: center;
  margin:0;
  overflow-x:hidden;
  background-color:#fff;
  a, a:visited{
    color: $link_color;
    text-decoration:none;
  }
  a:hover{
    color: $link_hover_color;
  }
}
// ******************************
// End of Normalize
// ******************************

// For extend styles
%burger_common {
  display:block;
  position:absolute;
  width:40px;
  height:4px;
  border-radius:2px;
  background-color:#fff;
}
%transition_all_04s_easeinout {
  @include transition(all .3s ease-in-out);
}
%backface_visibility_hidden{
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
}

// Main style
main {
  margin: 0 auto;
  transform-style:preserve-3d;
  @include transform(perspective(500px));
  
  #content {
    position:relative;
    top:0;
    padding:38vh 10vw 20vh;
    background-color:$bg_color;
    @extend %transition_all_04s_easeinout;
    @extend %backface_visibility_hidden;
  }
  article {
    h1 {
      font-size:45px;
      font-weight:bold;
      margin:0 0 100px 0;
    }
  }
}

.burger{
  display:inline-block;
  &.wrapper{
    position:absolute;
    top:0;
    left:0;
    cursor:pointer;
    
    // Page overlay on mouseover
    &::before{
      content:'';
      position:fixed;
      top:0;
      left:0;
      width:100%;
      height:100%;
      z-index:1;
      background-color:rgba(#000, 0.4);
      pointer-events:none;
      @extend %transition_all_04s_easeinout;
      @extend %backface_visibility_hidden;
      opacity:0;
    }
  }
  &.box{
    position:fixed;
    width:40px;
    height:24px;
    padding:15px;
    z-index:3;
  }
  &.inner{
    @extend %burger_common;
    top:50%;
    margin-top:-2px;
    @include transition(all .3s cubic-bezier(.55,.055,.675,.19));
    &::before,
    &::after{
      @extend %burger_common;
      content:'';
    }
    &::before{
      top:-10px;
      @include transition(top .1s .34s ease-in, opacity .1s ease-in-out);
    }
    &:after{
      bottom:-10px;
      @include transition(bottom .1s .34s ease-in, transform .3s cubic-bezier(.55,.055,.675,.19), -webkit-transform .3s cubic-bezier(.55,.055,.675,.19));
    }
  }
}

nav {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
  width:25vw;
  overflow-y:scroll;
  -ms-overflow-style:none;
  text-align:left;
  background-color:#000;
	z-index: 2;
  @include transform(translateX(-100%));
  @extend %transition_all_04s_easeinout;
  @extend %backface_visibility_hidden;
  &::-webkit-scrollbar{
    display:none;
  }
  ul {
    list-style-type:none;
    padding:0;
    margin:80px 0 0;
    @include transform(translateX(-100%));
    @include transition(all .3s cubic-bezier(0.49, 0.24, 0, 1.32) .2s);
    @extend %backface_visibility_hidden;
    li {
      line-height:1.2;
      a{
        display:block;
        padding:10px 5vw;
        margin:12px 0;
      }
    }
  }
}

#nav_check{
  position:absolute;
  visibility:hidden;
  
  // When the menu has shown
  &:checked {
    & + .burger{
      &.wrapper{
        &::before{
          opacity: 1;
          pointer-events: auto;
        }
      }
      
      .inner{
        @include transition(all .3s cubic-bezier(.215,.61,.355,1) .14s);
        @include transform(rotate(225deg));
        &::before{
          top:0;
          opacity:0;
          @include transition(top .1s ease-out, opacity .1s .14s ease-out);
        }
        &::after{
          bottom:0;
          @include transition(bottom .1s ease-out,transform .3s .14s cubic-bezier(.215,.61,.355,1), -webkit-transform .3s .14s cubic-bezier(.215,.61,.355,1));
          @include transform(rotate(-90deg));
        }
      }
   }
    
    & ~ nav {
      @include transform(translateX(0));
      ul {
        @include transform(translateX(0));
      }
    }
    
    & ~ main #content {
      transform-origin: left center;
      @include transform(translateX(15vw) translateZ(-20vw) rotateY(-13deg));
      @include filter(blur(3px));
    }
  }
}


            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console