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

              
                <input type="checkbox" role="switch" class="dia-de-los-muertos" />
<input type="checkbox" role="switch" class="dia-de-los-muertos" checked />
<input type="checkbox" role="switch" class="dia-de-los-muertos" disabled />
<input type="checkbox" role="switch" class="dia-de-los-muertos" disabled checked />
              
            
!

CSS

              
                .dia-de-los-muertos {
  appearance: none;
  font-size: 0.8em;
  width: 5em;
  height: 1em;
  border-radius: 3em;
  border: 1px solid #0000;
  background: #000c;
  position: relative;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;

  &::before {
    --tooth: #fff;
    content: "";
    width: 2.5em;
    height: 3em;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(0, -50%) rotate(0deg);
    border-radius: 100% / 80% 80% 140% 140%;
    clip-path: polygon(0 0, 100% 0, 100% 60%, 80% 70%, 80% 100%, 20% 100%, 20% 70%, 0 60%);
    transition: transform 0.5s, left 0.5s, opacity 0.5s;
    background: 
      /* eyes */
      radial-gradient(circle at 28% 48%, #000 0.3em, #0000 0.31em),
      radial-gradient(circle at 72% 48%, #000 0.3em, #0000 0.31em),
      /* nose */
      conic-gradient(at 0 70%, #0000 30deg, #000 0 120deg, #0000 0) 45% 67% / 0.15em 0.4em,
      conic-gradient(at 100% 70%, #0000 240deg, #000 0 330deg, #0000 0) 55% 67% / 0.15em 0.4em,
      /* teeth */
      linear-gradient(#000 0 0) 0.7em 85% / 0.07em 0.15em,
      linear-gradient(#000 0 0) 0.95em 85% / 0.075em 0.15em,
      linear-gradient(#000 0 0) 1.225em 85% / 0.075em 0.15em,
      linear-gradient(#000 0 0) 1.485em 85% / 0.07em 0.15em,
      linear-gradient(#000 0 0) 1.71em 85% / 0.07em 0.15em,
      radial-gradient(farthest-side circle at 50% 100%, var(--tooth) 60%, #000 0 99%, #0000) 0.7em 80% / 0.3em 0.15em,
      radial-gradient(farthest-side circle at 50% 100%, var(--tooth) 60%, #000 0 99%, #0000) 0.975em 80% / 0.3em 0.15em,
      radial-gradient(farthest-side circle at 50% 100%, var(--tooth) 60%, #000 0 99%, #0000) 1.25em 80% / 0.3em 0.15em,
      radial-gradient(farthest-side circle at 50% 100%, var(--tooth) 60%, #000 0 99%, #0000) 1.475em 80% / 0.3em 0.15em,
      radial-gradient(farthest-side circle at 50% 0%, var(--tooth) 60%, #000 0 99%, #0000) 0.7em 90% / 0.3em 0.15em,
      radial-gradient(farthest-side circle at 50% 10%, var(--tooth) 60%, #000 0 99%, #0000) 0.975em 90% / 0.3em 0.15em,
      radial-gradient(farthest-side circle at 50% 0%, var(--tooth) 60%, #000 0 99%, #0000) 1.25em 90% / 0.3em 0.15em,
      radial-gradient(farthest-side circle at 50% 0%, var(--tooth) 60%, #000 0 99%, #0000) 1.475em 90% / 0.3em 0.15em,
      linear-gradient(var(--tooth) 33%, #000 0 66%, var(--tooth) 0)  50% 85.5% / 1em 0.2em,
      /* extra */
      #fff;
    background-repeaT: no-repeat;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  &:checked {
    &::before {
      left: calc(100% - 2.5em);
      transform: translate(0, -50%) rotate(360deg);
    }
  }
  
  &[disabled] {
    opacity: 0.33;
  }
}

@media print {
  .dia-de-los-muertos {
    &::before {
      border: 1px solid #000;
    }
  }
}

@media (prefers-contrast: more) {
  .dia-de-los-muertos {
    &::before {
      background: highlight;
      -webkit-mask:
        radial-gradient(circle at 51% 69%, #0000 0.3em, #f00 0) 0 0 / 55% 70% no-repeat,
        radial-gradient(circle at 49% 69%, #0000 0.3em, #f00 0) 100% 0 / 55% 70% no-repeat,
        linear-gradient(#f00 48%, #0000 0 55%, #f00 0) 100% 100% / 100% 35% no-repeat,
        linear-gradient(90deg, #f00 35%, #0000 0 65%, #f00 0) 100% 100% / 100% 35% no-repeat;
    }
  }
}

@media (prefers-reduced-motion) {
  .dia-de-los-muertos {
    &::before {
      transition-duration: 0s, 0s, 0s;
    }
  }
}


/* DEMO ONLY */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  background: #223;
}

label {
  display: flex;
  align-items: center;
  gap: 1em;
  color: #eeec;
  font-size: 5vmin;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 200;
}
              
            
!

JS

              
                
              
            
!
999px

Console