cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

CSS Animated Sandwich Icon

A Pen By Captain Anonymous

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.

            
              body {background-color: #333;}

$w = 100px
$h = 10px

#sandwich 
  width $w
  height $w
  position: absolute;
  top:0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;




.sw-topper
    position: relative
    top: 0
    width $w 
    height $h
    background: rgb(255, 255, 255);
    border: none; 
    border-radius: 4px 4px 4px 4px;
    transition: transform 0.5s, top 0.2s;
        
    /* transition-delay: 0.2s, 0s; */



.sw-bottom
    position: relative
    width $w
    height $h
    top @height * 2
    
    background: rgb(255, 255, 255);
    border: none;
    border-radius: 4px 4px 4px 4px;
    transition: transform 0.5s, top 0.2s;
    transition-delay: 0.2s, 0s; 

.sw-footer
    position: relative
    width $w
    height $h
    top @height * 4
    background: rgb(255, 255, 255);
    border: none;
    border-radius: 4px 4px 4px 4px;
    transition: all 0.5s;
    transition-delay: 0.1s; 

#sandwich.active 
  .sw-topper
    top: 15px;
    transform: rotate(140deg);
  .sw-bottom
    top: 5px;
    transform: rotate(-140deg);
  .sw-footer
    opacity: 0;
    top: 0;
    transform: rotate(180deg);


            
          
!
            
              $("#sandwich, .menu_item").click(function() {
  $("#sandwich").toggleClass("active");
});
            
          
!
999px
Loading ..................

Console