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

              
                <div class="wrapper">
  <div class="burger">
    <div class="one"></div>
    <div class="two"></div>
    <div class="three"></div>
  </div>

  <div class="circle"></div>
</div>

<a target="_blank" href="https://dribbble.com/shots/1623679-Open-Close">Inspired by Creativedash's Open & Close animation</a>
              
            
!

CSS

              
                @import "compass/css3";

@import "compass/css3/transform";

@mixin transitions($time, $easing, $delay:0s) {
	-webkit-transition: all $time $easing $delay;
	   -moz-transition: all $time $easing $delay;
	    -ms-transition: all $time $easing $delay;
	     -o-transition: all $time $easing $delay;
	        transition: all $time $easing $delay;
}
       
@mixin animation($name, $time) {
  -webkit-animation: $name $time infinite;
     -moz-animation: $name $time infinite;
       -o-animation: $name $time infinite;
          animation: $name $time infinite;
  -webkit-animation-direction: alternate;
          animation-direction: alternate;
}
        
@mixin keyframes($name) {
  @-webkit-keyframes #{$name} {
    @content; 
  }
  @-moz-keyframes #{$name} {
    @content;
  }
  @-ms-keyframes #{$name} {
    @content;
  }
  @keyframes #{$name} {
    @content;
  } 
}
    
body {
  background: #31AA39; 
  text-align: center;
  margin: 0;
  padding: 0;
}

a {
  color: #fff;
  font-family: sans-serif;
  text-decoration: none;
  
  &:hover { border-bottom: 2px solid white; }
}

.wrapper {
  text-align: center;
  margin: 200px auto 50px auto;
}

.burger {
  height: 30px;
  width: 33px;
  cursor: pointer;
  margin: 0 auto;
  display: block;

  .one,
  .two,
  .three {
    margin-top: 3px;
    background: #fff;
    width: 33px;
    height: 4px;
    position: absolute;
    border-radius: 2px;
    @include transitions(0.2s, ease-in-out);
  }
      
  .one { 
    @include animation(layer-one, 2.3333s); 
  }

  .two { 
    margin-top: 13px; 
    @include transform-origin(33px,0);
    @include animation(layer-two, 2.3333s); 
  }
  
  .three { 
    margin-top: 23px;
    @include animation(layer-three, 2.3333s);
  }
}
            
// Animation for the top layer
@include keyframes(layer-one) {
  0% {
     @include simple-transform(1, 0deg, 0, 0);
  }
  26.5% {
     @include simple-transform(1, 0deg, 0, 0);
  }
  33% {
     @include simple-transform(1, 25deg, 0, 0);
  }
  40% {
     @include simple-transform(1, -60deg, 0, 14px);
  }
  60% {
     @include simple-transform(1, -45deg, 0, 14px);
  } 
  100% {
     @include simple-transform(1, -45deg, 0, 14px);
  } 
}

// Animation for the bottom layer
@include keyframes(layer-three) {
  0% {
    @include simple-transform(1, 0deg, 0, 0);
  }
  26.5% {
    @include simple-transform(1, 0deg, 0, 0);
  }
  33% {
    @include simple-transform(1, -25deg, 0, 0);
  }
  40% {
    @include simple-transform(1, 60deg, 0, -14px);
  }
  60% {
    @include simple-transform(1, 45deg, 0, -14px);
  } 
  100% {
    @include simple-transform(1, 45deg, 0, -14px);
  } 
}


// Animation for the middle layer
@include keyframes(layer-two) {
  0% {
		@include transform(translateX(0) scaleX(1));
  }
  26.5% {
		@include transform(translateX(0) scaleX(1));
  }
  33% {
		@include transform(translateX(-10px) scaleX(0.95));
  }
  36.5% {
		@include transform(translateX(28px) scaleX(1));
  }
  44% {
		@include transform(translateX(28px) scaleX(0));
  } 
  100% {
		@include transform(translateX(28px) scaleX(0));
  } 
}

// ----------
// CIRCLE
// ----------
.circle {
  width: 60px;
  height: 60px;
  border: 4px solid #fff;
  border-radius: 60px;
  display: block;
  position: absolute;
  left: 50%;
  margin-left: -25px;
  margin-top: -49px;
  @include transitions(0.2s, ease-in-out);
  @include animation(circle-anim, 2.3333s);
}


@include keyframes(circle-anim) {
  0% {
    @include transform(rotate(90deg));
    clip: rect(0px, 0px, 0px, 0px);
  }
  26.5% {
    @include transform(rotate(90deg));
    clip: rect(0px, 0px, 0px, 0px);
  }
  33% {
    @include transform(rotate(90deg));
    clip: rect(0px, 0px, 0px, 0px);
  }
  60% {
    @include transform(rotate(120deg));
    clip: rect(0px, 35px, 35px, 0px);
  }
  100% {
    @include transform(rotate(-360deg));
    clip: rect(auto, auto, auto, auto);
  } 
}
              
            
!

JS

              
                
              
            
!
999px

Console