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

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

              
                input(type='checkbox')
input#skeuomorphism(type='radio' name='style' checked)
input#neumorphism(type='radio' name='style')
div.toggle-switch
div.background
div.styles
  label(for='skeuomorphism') skeuomorphism
  label(for='neumorphism') neumorphism
              
            
!

CSS

              
                $dark: #1d2532;
$light: #dedad3;
$black: #000000;
$white: #ffffff;

:root {
  font-size: 16px;
}

html,
body {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 14rem;
}

body {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  justify-content: center;
  position: relative;
}

.background {
  display: block;
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: $dark;
  transition: background-color 300ms ease-out 0s;

  &:before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    background-image: url($noise-image-white);
    background-repeat: repeat;
    opacity: 0.4;
    transition: opacity 300ms ease-out 0s;
  }
}

// HIDDEN CHECKBOX

input[type="checkbox"] {
  display: block;
  position: relative;
  z-index: 100;
  margin-top: -7rem;
  bottom: -7rem;
  width: 16rem;
  height: 7rem;
  border-radius: 3.5rem;
  cursor: pointer;
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
}

input[type="checkbox"]:checked ~ .background {
  background-color: $light;

  &:before {
    background-image: url($noise-image-black);
    opacity: 0.8;
  }
}

// STYLE SELECTOR

.styles {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: center;
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;

  label {
    cursor: pointer;
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: transparentize($black, 0.7);
    transition: color 300ms ease-out 0s;
    margin: 0 0.5rem;
  }
}

input[type="radio"] {
  display: block;
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  border: none;
  outline: none;
  visibility: hidden !important;
}

input[type="radio"]#skeuomorphism:checked ~ .styles label[for="skeuomorphism"] {
  color: transparentize($black, 0.45);
}

input[type="radio"]#neumorphism:checked ~ .styles label[for="neumorphism"] {
  color: transparentize($black, 0.45);
}

input[type="checkbox"]:checked ~ input[type="radio"] {
  & ~ .styles label {
    color: transparentize($black, 0.8);
  }

  &#skeuomorphism:checked ~ .styles label[for="skeuomorphism"] {
    color: transparentize($black, 0.65);
  }

  &#neumorphism:checked ~ .styles label[for="neumorphism"] {
    color: transparentize($black, 0.65);
  }
}

// TOGGLE SWITCH

.toggle-switch {
  display: block;
  position: relative;
  width: 16rem;
  height: 7rem;
  border-radius: 3.5rem;
  transition: box-shadow 300ms ease-out 0s;

  &:before,
  &:after {
    content: "";
    display: block;
    position: absolute;
    z-index: 50;
    top: 0.25rem;
    left: 0.25rem;
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 3.5rem;
    transition: left 300ms ease-out 0s, background-color 300ms ease-out 0s,
      box-shadow 300ms ease-out 0s;
  }

  &:after {
    background-image: url($noise-image-white);
    background-repeat: repeat;
    opacity: 0.4;
    transition: opacity 300ms ease-out 0s;
  }
}

input[type="checkbox"]:checked ~ .toggle-switch {
  &:before,
  &:after {
    left: 9.25rem;
  }

  &:after {
    background-image: url($noise-image-black);
    opacity: 0.8;
  }
}

// SKEUOMORPHISM

input[type="radio"]:nth-of-type(2):checked ~ .toggle-switch {
  box-shadow: inset 0 0 7rem 7rem transparentize($black, 0.7),
    inset 0 0.8rem 0.4rem transparentize($black, 0.7),
    inset 0 3rem 1rem transparentize($black, 0.75),
    0 -0.25em 0.25em transparentize($black, 0.8),
    0 0.25em 0.25em transparentize($white, 0.92);

  &:before {
    background-color: lighten($dark, 5%);
    box-shadow: inset 0 0.25rem 0.25rem transparentize($white, 0.92),
      inset 0 -0.25rem 0.25rem transparentize($black, 0.8),
      0 0.6rem 0.4rem transparentize($black, 0.5),
      0 1.25rem 1rem transparentize($black, 0.5);
  }
}

input[type="checkbox"]:checked
  ~ input[type="radio"]:nth-of-type(2):checked
  ~ .toggle-switch {
  box-shadow: inset 0 0 7rem 7rem transparentize($black, 0.9),
    inset 0 0.8rem 0.4rem transparentize($black, 0.8),
    inset 0 3rem 1rem transparentize($black, 0.9),
    0 -0.25em 0.25em transparentize($black, 0.85),
    0 0.25em 0.25em transparentize($white, 0.6);

  &:before {
    background-color: darken($light, 7%);
    box-shadow: inset 0 0.25rem 0.25rem transparentize($white, 0.6),
      inset 0 -0.25rem 0.25rem transparentize($black, 0.85),
      0 0.6rem 0.4rem transparentize($black, 0.75),
      0 1.25rem 1rem transparentize($black, 0.75);
  }
}

// NEUMORPHISM

input[type="radio"]:nth-of-type(3):checked ~ .toggle-switch {
  &:before {
    box-shadow: inset 0 0 7rem 7rem transparentize($white, 0.995),
      -0.35rem -0.35rem 0.9rem 0.2rem transparentize($white, 0.96),
      0.5rem 0.5rem 1rem 0.2rem transparentize($black, 0.6),
      inset 0.25rem 0.25rem 0.5rem transparentize($white, 0.96),
      inset -0.25rem -0.25rem 0.5rem transparentize($black, 0.6);
  }

  &:after {
    opacity: 0;
  }
}

input[type="checkbox"]:checked
  ~ input[type="radio"]:nth-of-type(3):checked
  ~ .toggle-switch {
  &:before {
    box-shadow: inset 0 0 7rem 7rem transparentize($black, 0.99),
      -0.35rem -0.35rem 0.9rem 0.2rem transparentize($white, 0.68),
      0.5rem 0.5rem 1rem 0.2rem transparentize($black, 0.8),
      inset 0.25rem 0.25rem 0.5rem transparentize($white, 0.68),
      inset -0.25rem -0.25rem 0.5rem transparentize($black, 0.8);
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console