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.

            
              <div class="container">
  <h1>CSS3 Mobile <span>Menu</span> Icons vol.2</h1>
  <div class="subheader">(click to check effect)</div>
  
  <div class="link">
    <a href="https://codepen.io/fox_hover/pen/PmGMxY" title="Check vol.1" target="_blanc"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i> Check vol.1</a>
  <a href="https://github.com/eisenfox/menu-icons-2" title="Check on GitHub" target="_blanc"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i> Check on GitHub</a>
  <a href="http://100dayscode.co.uk/" title="Check Codepen Challenge" target="_blanc"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i> Check Codepen Challenge</a>
</div>
  
 <div class="icons-container">
    
    <!--icon #1-->
    <div class="icon">
      <h2>#1</h2>
      <div class="menu-icon menu-icon-1">
        <div class="bar bar-1"></div>
        <div class="bar bar-2"></div>
        <div class="bar bar-3"></div>
      </div>
    </div>
   
    <!--icon #2-->
    <div class="icon">
      <h2>#2</h2>
      <div class="menu-icon menu-icon-2">
        <div class="bar bar-1"></div>
        <div class="bar bar-2"></div>
        <div class="bar bar-3"></div>
      </div>
    </div>
   
    <!--icon #3-->
    <div class="icon">
      <h2>#3</h2>
      <div class="menu-icon menu-icon-3">
        <div class="bar bar-1"></div>
        <div class="bar bar-2"></div>
        <div class="bar bar-3"></div>
      </div>
    </div>
   
    <!--icon #4-->
    <div class="icon">
      <h2>#4</h2>
      <div class="menu-icon menu-icon-4">
        <div class="bar bar-1"></div>
        <div class="bar bar-2"></div>
        <div class="bar bar-3"></div>
      </div>
    </div>
   
    <!--icon #5-->
    <div class="icon">
      <h2>#5</h2>
      <div class="menu-icon menu-icon-5">
        <div class="bar bar-1"></div>
        <div class="bar bar-2"></div>
        <div class="bar bar-3"></div>
      </div>
    </div>
   
    <!--icon #6-->
    <div class="icon">
      <h2>#6</h2>
      <div class="menu-icon menu-icon-6">
        <div class="bar bar-1"></div>
        <div class="bar bar-2"></div>
        <div class="bar bar-3"></div>
      </div>
    </div>
   
    <!--icon #7-->
    <div class="icon">
      <h2>#7</h2>
      <div class="menu-icon menu-icon-7">
        <div class="bar bar-1"></div>
        <div class="bar bar-2"></div>
        <div class="bar bar-3"></div>
      </div>
    </div>
   
  </div>
  
</div>
            
          
!
            
              //color variables and mixins
$accent-font-color: #A53860;
$basic-icon-color: #000;
$accent-icon-color: #fff;

//transitions mixin
@mixin transition-mix($property: all, $duration: 0.2s, $timing: linear, $delay: 0s) {
  transition-property: $property;
  transition-duration: $duration;
  transition-timing-function: $timing;
  transition-delay: $delay;
}

//position absolute mixin
@mixin position-absolute ($top: null, $left: null, $right: null, $bottom: null) {
  position: absolute;
  top: $top;
  left: $left;
  right: $right;
  bottom: $bottom;
}

/* common styles !!!YOU DON'T NEED THEM  */
body {
  font: {
    family: 'Raleway', sans-serif;
    size: 16px;
  }
}

.container {
  width: 850px;
  margin: 70px auto 0px auto;
  text-align:  center;
  
  h1 {
    font: {
      weight: 400;
      size: 35px;
    }
    
    span {
      font: {
        family: 'Satisfy', cursive;
      }
      color: $accent-font-color;
      position: relative;
      display: inline-block;
      
      &:after {
        content: '';
        display: block;
        width: 10px;
        height: 20px;
        @include position-absolute($top: -12px, $right: 0);
        border-left: 2px solid currentColor;
        border-bottom: 8px solid currentColor;
        border-radius: 50%;
        transform: rotate(-90deg);
      }
    }
  }
  
  .subheader {
    margin-top: 10px;
  }
  
  .link {
    display: flex;
    justify-content: space-around;
    width: 80%;
    margin: 30px auto 0;
    
    a {
      color: #1f1f1f;
      font: {
        size: 17px;
      }
      display: inline-block;

      i {
        color: $accent-font-color;
        margin-right: 5px
      }
    }
  }
  
  .icons-container {
    margin-top: 50px;
    display: flex;
    justify-content: center;
    
    h2 {
      margin-bottom: 10px;
    }
    
    .icon {
      margin-right: 30px;
      
      &:last-child {
        margin-right: 0;
      }
    }
  }
}

/* icon basic styles !!!YOU NEED THEM  */
//menu icon variables
$icon-width: 40px;
$icon-height: 25px;

$bar-width: 5px;
$bar2-position: $bar-width*2;
$bar3-position: $bar-width*4;

.menu-icon {
  height: $icon-height;
  cursor: pointer;
  width: $icon-width;
  position: relative;
  overflow: hidden;
  
  &:before,
  &:after {
    @include transition-mix;
    content: '';
    display: block;
    width: 4px;
    height: 28px;
    border-radius: 10px;
    transform-origin: center center;
    background-color: $basic-icon-color;
  }
  
  &:before {
    @include position-absolute($top: 0, $left: 18px);
    transform: rotate(-45deg);
  }
  
  &:after {
    @include position-absolute($top: 0, $right: 18px);
    transform: rotate(45deg);
  }
  
  .bar {
    @include transition-mix($delay: 0.2s);
    width: 100%;
    height: $bar-width;
    background-color: $basic-icon-color;
    border-radius: 20px;
    
    &-1 {
      @include position-absolute($top: 0, $left: 0);
    }
    
    &-2 {
      @include position-absolute($top: $bar2-position, $left: 0);
    }
    
    &-3 {
      @include position-absolute($top: $bar3-position, $left: 0);
    }
  }
  
  &.opened {
    
    .bar {
      @include transition-mix;
    }
    
    &:before,
    &:after {
      @include transition-mix($delay: 0.2s);
    }
  }
}

//icon-1 styles
.menu-icon-1 {
  
  .bar {
    transform-origin: left center;
  }
  
  &:before {
    transform: scale(0,0) rotate(-45deg);
  }
  
  &:after {
    transform: scale(0,0) rotate(45deg);
  }
  
  &:before,
  &:after {
    opacity: 0;
  }
  
  &.opened {
    
    &:before,
    &:after {
      transition-delay: 0.2s;
      opacity: 1;
    }
    
    &:before {
      transform: scale(1) rotate(-45deg);
    }
    
    &:after {
      transform: scale(1) rotate(45deg);
    }
    
    .bar {
      transform: scale(0,1);
      
      &-1 {
        transition-delay: 0s;
      }
      
      &-2 {
        transition-delay: 0.05s;
      }
      
      &-3 {
        transition-delay: 0.1s;
      }
    }
  }
}

//icon-2 styles
.menu-icon-2 {
  
  &:before {
    transform: scale(1.3) rotate(-45deg);
  }
  
  &:after {
    transform: scale(1.3) rotate(45deg);
  }
  
  &:before,
  &:after {
    opacity: 0;
  }
  
  &.opened {
    
    .bar {
      transform: translateX(40px);
    }
    
    &:before,
    &:after {
      opacity: 1;
    }
    
    &:before {
      transform: scale(1) rotate(-45deg);
    }
    
    &:after {
      transform: scale(1) rotate(45deg);
    }
  }
}

//icon-3 styles
.menu-icon-3 {
  
   &:before {
    transform: rotate(-90deg);
  }
  
  &:after {
    transform: rotate(90deg);
  }
  
  &:before,
  &:after {
    top: -2px;
  }
  
  &.opened {
    
    &:before {
      transform: rotate(-45deg);
    }

    &:after {
      transform: rotate(45deg);
    }

    &:before,
    &:after {
      top: 0px;
    }
    
    .bar {
      opacity: 0;
      
      &-1 {
        top: $bar2-position;
      }
      
      &-3 {
        top: $bar2-position;
      }
    }
  }
}

//icon-4 styles
.menu-icon-4 {
  
  &:before {
     transform: scale(0,1) rotate(-45deg);
   }

    &:after {
      transform: scale(0,1) rotate(45deg);
    }
  
  &.opened {
    
    &:before {
     transform: scale(1,1) rotate(-45deg);
   }

    &:after {
      transform: scale(1,1) rotate(45deg);
    }
    
    .bar {
      transform: scale(0.4);
      opacity: 0;
    }
  }
}

//icon-5 styles
.menu-icon-5 {
  
   &:before {
     transform: translateX($icon-width) rotate(-45deg);
   }

    &:after {
      transform: translateX($icon-width) rotate(45deg);
    }
  
  &.opened {
    
    &:before {
     transform: translateX(0) rotate(-45deg);
   }

    &:after {
      transform: translateX(0) rotate(45deg);
    }
    
    .bar {
    
      transform: scale(0,1);

      &-1 {
        transition-delay: 0s;
      }

      &-2 {
        transition-delay: 0.05s;
      }

      &-3 {
        transition-delay: 0.1s;
      } 
    }
  }
}

//icon-6 styles
.menu-icon-6 {
  
  &:before {
     transform: translateY($icon-width) rotate(-45deg);
   }

    &:after {
      transform: translateY($icon-width) rotate(45deg);
    }
  
  &.opened {
    
    &:before {
     transform: translateY(0px) rotate(-45deg);
      transition-timing-function: cubic-bezier(0, 0.91, 0, 1.31);
   }

    &:after {
      transform: translateY(0px) rotate(45deg);
      transition-timing-function: cubic-bezier(0, 0.91, 0, 1.31);
    }
    
    .bar {
      opacity: 0;
      
      &-1 {
        top: - $bar-width;
      }
      
      &-3 {
        top: $bar-width * 5;
      }
    }
  }
}

//icon-7 styles
.menu-icon-7 {
  
  &:before,
  &:after {
    top: -2px;
    opacity: 0;
  }
  
  &:before {
     transform: rotate(90deg);
   }

    &:after {
      transform: rotate(-90deg);
    }
  
  &.opened {
    
    &:before,
    &:after {
      top: 0px;
      opacity: 1;
    }
    
    &:before {
     transform: rotate(-45deg);
   }

    &:after {
      transform: rotate(45deg);
    }
    
    .bar {
      
      &-1 {
        top: - $bar-width * 3;
        transition-delay: 0.1s;
      }
      
      &-2 {
        top: - $bar-width * 4;
        transition-delay: 0.05s;
      }
      
      &-3 {
        top: - $bar-width * 5;
      }
    }
  }
}
            
          
!
            
              jQuery('.menu-icon').click(function() {
  jQuery(this).toggleClass('opened');
});
            
          
!
999px
Loading ..................

Console