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

              
                <label class="c-custom-checkbox">
    <input type="checkbox" checked />
    <svg width="32" height="32" viewBox="-4 -4 39 39" aria-hidden="true" focusable="false">
        <!-- The background -->
        <rect class="cb-bg" width="35" height="35" x="-2" y="-2" stroke="currentColor" fill="none" stroke-width="3"
            rx="6" ry="6"></rect>
        <!-- The checkmark-->
        <polyline class="cb-cm" points="4,14 12,23 28,5" stroke="transparent" stroke-width="4" fill="none"></polyline>
    </svg>

    <span>Feed the birbs</span>
</label>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap');

.c-custom-checkbox {
	cursor: pointer;

  display: flex;
  align-items: start;

  --checked-state-bg-color: hsl(350, 95%, 58%);
  --checked-state-check-color: #fff;
  --outline-color: var(--checked-state-bg-color);
  --outline-offset: 2px;
}

// hide the checkbox accessibly
.c-custom-checkbox input[type="checkbox"] {
  /* remove the checkbox from the page flow, positioning it on top of the SVG */
  position: absolute;
  /* set same dimensions as the SVG */
  width: 1em;
  height: 1em;
  /* hide it */
  opacity: 0;
}

// basic styles for the svg
.c-custom-checkbox svg {
  /* set SVG dimensions in ems; i.e. relative to the font size so that it scales with the size of the font. */
  width: 1em;
  height: 1em;
  
  margin-right: 0.5em;
  margin-top: .1em;

  /* apply a transition to the elements inside the svg */
  * {
    transition: all 0.1s linear;
  }
}

// style changes inside the svg when the checkbox is checked
.c-custom-checkbox input[type="checkbox"]:checked + svg {
  .cb-bg {
    fill: var(--checked-state-bg-color);
    stroke: var(--checked-state-bg-color);
  }

  .cb-cm {
    stroke: var(--checked-state-check-color);
  }
}

.c-custom-checkbox input[type="checkbox"]:focus + svg {
  outline: 3px solid var(--outline-color);
  outline-offset: var(--outline-offset);
}

.c-custom-checkbox input[type="checkbox"]:focus:not(:focus-visible) + svg {
  outline: none;
}

/* WHCM styles */
.c-custom-checkbox svg {
  @media screen and (-ms-high-contrast: active) {
    rect {
      stroke: windowText;
    }
  }
}

@media screen and (-ms-high-contrast: active) {
  .c-custom-checkbox input[type="checkbox"]:checked ~ svg {
    rect {
      fill: windowText;
    }

    polyline {
      stroke: highlight;
    }
  }
}




body {
	padding: 10vw;
	font-size: 3rem;
	line-height: 1.2;
	font-family: 'Fira Sans', sans-serif;
	background: hsl(31, 28%, 94%);
	color: hsl(195, 11%, 23%);
}
              
            
!

JS

              
                
              
            
!
999px

Console