Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <svg xmlns="http://www.w3.org/2000/svg" style="display: none">
  <symbol id="checkmark" viewBox="0 0 24 24">
    <path stroke-linecap="round" stroke-miterlimit="10" fill="none"  d="M22.9 3.7l-15.2 16.6-6.6-7.1">
    </path>
  </symbol>
</svg>

<div class="form-container">
  <p>A custom checkbox :D</p>
  <div class="promoted-checkbox">
    <input id="tmp" type="checkbox" class="promoted-input-checkbox"/>
    <label for="tmp">
      <svg><use xlink:href="#checkmark" /></svg>      
      Save recipient    
    </label>
  </div>
<div>
              
            
!

CSS

              
                $brand: #0080d3;
$grey-25: #e6e6e6;
$grey-5: #fcfcfc;

*, *:before, *:after {
  box-sizing: border-box;
}

.form-container {
  padding: 1rem;
  margin: 2rem auto;
  background-color: $grey-5;
  border: 1px solid $grey-25;
  width: 50%;
}

/* HTML5 Boilerplate accessible hidden styles */
.promoted-input-checkbox {
  border: 0; 
  clip: rect(0 0 0 0); 
  height: 1px; margin: -1px; 
  overflow: hidden; 
  padding: 0; 
  position: absolute; 
  width: 1px;
}

.promoted-checkbox {
  input:checked + label > svg {
    // Firefox doesn't render svg's that is loading with the use tag if its been set to display: none and then toggled to display: block, so you have to use tricks like this to get it to render again:
    height: 24px;
    animation: draw-checkbox ease-in-out 0.2s forwards;
  }
  
  label:active::after {
    background-color: $grey-25;
  }
  
  label {
    color: $brand;
    line-height: 40px;
    cursor: pointer;
    position: relative;
    &:after {
      content: "";
      height: 40px;
      width: 40px;
      margin-right: 1rem;
      float: left;
      border: 2px solid $brand;
      border-radius: 3px;
      transition: 0.15s all ease-out;      
    }
  }
  svg {
    stroke: $brand;
    stroke-width: 2px;
    height: 0; //Firefox fix
    width: 24px;
    position: absolute;
    left: -48px;
    top: -4px;
    stroke-dasharray: 33; //Firefox fix
  }
}

@keyframes draw-checkbox {
  0% {
    stroke-dashoffset: 33;
  }
  100% {
    stroke-dashoffset: 0;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console