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.

            
              darkViolet = #262a3f
cream = #fff8e4

body
  background cream

 buttonSize = 50px
 radius = 3px
 thickness = 7px
  
button
  position relative
  display block
  border none
  outline none
  background none
  width buttonSize
  height buttonSize
  margin "calc(50vh - %s) auto" % ceil(buttonSize / 2)
  
icon($height, $buttonSize)
  transition inherit
  position absolute
  width ($buttonSize / 2)
  height $height
  background darkViolet
  top ceil(($buttonSize - $height) / 2)

icon-before($top)
  transition inherit
  position absolute
  width inherit
  height inherit
  background darkViolet
  content ""
  top $top

icon-after($top)
  transition inherit
  position absolute
  width inherit
  height inherit
  background darkViolet
  content ""
  top $top
  
.hamburger
  position absolute
  width buttonSize
  height buttonSize
  top 0
  left 0
  transition transform .3s ease-in-out, background-color .3s ease-in-out
  &:hover
    cursor pointer
  .left
    icon(thickness, buttonSize)
    border-top-left-radius radius
    border-bottom-left-radius radius
    left 0px
    &:before
      icon-before((- ceil(buttonSize / 3)))
    &:after
      icon-before((ceil(buttonSize / 3)))
    &:after, &:before
      border-radius inherit
      left inherit
  .right
    icon(thickness, buttonSize)
    right 0
    border-top-right-radius radius
    border-bottom-right-radius radius
    &:before
      icon-before((- ceil(buttonSize / 3)))
    &:after
      icon-before((ceil(buttonSize / 3)))
    &:after, &:before
      border-radius inherit
      right inherit
  &.open
    .left
      background transparent      
      &:before
        transform rotateZ(45deg) scaleX(1.4) translate(ceil(thickness/2), ceil(thickness/2))
      &:after
        transform rotateZ(-45deg) scaleX(1.4) translate(ceil(thickness/2), - ceil(thickness/2))
    .right
      background transparent  
      &:before
        transform rotateZ(-45deg) scaleX(1.4) translate(- ceil(thickness/2), ceil(thickness/2))
      &:after
        transform rotateZ(45deg) scaleX(1.4) translate(- ceil(thickness/2), - ceil(thickness/2))

            
          
!
            
              $('button').find('.hamburger').click (function() {
  $(this).toggleClass('open');
});

            
          
!
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