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

              
                
<button>
  <svg viewBox="0 0 120 120">
    <g>
      <path class="line top" d="M35,35h50c14.1,0,50.6,13,20.5,53.5s-121.9,21.6-94.4-40.3S111.6,8.4,85,35L35,85"/>
      <path class="line bottom" d="M35,85h50c14.1,0,50.6-13,20.5-53.5S-16.4,9.9,11.1,71.8S111.6,111.6,85,85L35,35"/>
      <line class="line cross" x1="35" y1="60" x2="85" y2="60"/>
    </g>
  </svg>
</button>

              
            
!

CSS

              
                body {
  padding: 0;
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #dddee1;
}

button {
  border: none;
  background: transparent;
  outline: none;
  cursor: pointer;
  padding: 0;
}

button:hover .line {
  stroke: #6662c4;
}

svg {
  display: block;
  width: 200px;
  height: 200px;
}

.line {
  fill: none;
  stroke: #71818d;
  stroke-width: 6px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hamburger */
.line.top,
.line.bottom {
  stroke-dasharray: 50px 600px;
  stroke-dashoffset: 0px;
}

.line.cross {
  stroke-dasharray: 50px 60px;
  stroke-dashoffset: 0px;
}

/* Cross */
.on .line.top,
.on .line.bottom {
  stroke-dasharray: 70.71px 600px;
  stroke-dashoffset: -392px; 
}

.on .line.cross {
  stroke-dasharray: 50px 60px;
  stroke-dashoffset: 51px;
}

/* Timing */
$timing: 0.35s;

.line.cross {
  transition: $timing stroke-dasharray ease $timing,
    $timing stroke-dashoffset ease $timing,
    $timing stroke ease 0s;
}

.line.top {
  transition: ($timing * 1.5) stroke-dasharray ease 0s,
    ($timing * 1.5) stroke-dashoffset ease 0s,
    $timing stroke ease 0s;
}

.line.bottom {
  transition: ($timing * 1.5) stroke-dasharray ease $timing,
    ($timing * 1.5) stroke-dashoffset ease $timing,
    $timing stroke ease 0s;
}

.on .line.cross {
  transition: $timing stroke-dasharray ease 0s,
    $timing stroke-dashoffset ease 0s,
    $timing stroke ease 0s;
}
              
            
!

JS

              
                document.querySelector('button').addEventListener('click', function(e) {
  e.currentTarget.classList.toggle('on');
});
              
            
!
999px

Console