cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <label class="button">
  <input type="checkbox">
  <span class="hole">
    <span class="switch">
      <span class="one"></span>
      <span class="zero"></span>
    </span>
  </span>
</label>
            
          
!
            
              .button {
  position: absolute;
  top: ~"calc(50% - 115px)";
  left: ~"calc(50% - 90px)";
  display: block;
  width: 180px;
  height: 230px;
  background-image: linear-gradient(to bottom, #464A54 0%, #2C2225 100%);
  border-radius: 6px;
  cursor: pointer;
  box-shadow:
    0 -5px 0px #464649,
    0 4px 20px fade(black, 50%),
    0 2px 1px #66696E inset,
    4px 0 0 fade(black, 10%) inset,
    -4px 0 0 fade(black, 10%) inset,
    0 -8px 2px fade(black, 10%) inset;
  
  .hole {
    position: absolute;
    top: 20px;
    left: 20px;
    display: block;
    width: 140px;
    height: 186px;
    overflow: hidden;
    background-color: #090909;
    border-radius: 8px;
    box-shadow: 
      0 -2px 1px fade(white, 25%) inset,
      0 2px 1px fade(white, 20%) inset;
  }

  .switch {
    position: absolute;
    top: 6px;
    left: 4px;
    display: block;
    width: 132px;
    height: 174px;
    background-image:
      radial-gradient(ellipse at center, fade(white, 7%) 0%, transparent 80%),
      radial-gradient(ellipse at center, fade(black, 15%) 0%, transparent 80%),
      radial-gradient(ellipse at center, fade(white, 2%) 0%,  fade(white, 2%) 30%, transparent 50%),
      linear-gradient(to bottom, #882626 0%, #290606 100%);
    background-size: 100% 80px, 100% 80px, 10px 10px, 100%;
    background-position: top left, bottom left, bottom left, center;
    background-repeat: no-repeat, no-repeat, repeat, no-repeat;
    border-radius: 8px;
    box-shadow:
      2px 0 1px fade(white, 10%) inset,
      -2px 0 1px fade(white, 10%) inset,
      0 -2px 2px fade(white, 5%) inset,
      0 4px 2px fade(black, 5%) inset,
      0 -30px 8px fade(#C62D2D, 50%),
      0 -25px 8px fade(#C62D2D, 30%),
      0 -20px 8px fade(#C62D2D, 40%),
      0 -15px 8px fade(#C62D2D, 50%),
      0 -10px 8px fade(#C62D2D, 60%),
      0 -5px 8px fade(#C62D2D, 90%);
    transform-style: preserve3d;
    transform-origin: center center;
    transform:
      perspective(1500px)
      rotateX(-30deg)
      translateY(16px);
    transition: transform 200ms ease;

    &:before {
      content: "";
      position: absolute;
      top: -2px;
      left: 5px;
      width: 122px;
      height: 5px;
      background-image: radial-gradient(ellipse at center, fade(white, 40%) 0%, transparent 80%);
    }

    .one {
      position: absolute;
      top: 24px;
      left: calc(50% - 3px);
      display: block;
      width: 6px;
      height: 40px;
      background-image: linear-gradient(to bottom, #ccc 0%, #999 100%);
      box-shadow: 0 2px 1px white inset;
      border-radius: 4px;
    }

    .zero {
      position: absolute;
      bottom: 24px;
      left: calc(50% - 14px);
      display: block;
      width: 32px;
      height: 40px;
      box-shadow:
        0 4px 2px fade(white, 50%) inset,
        0 -4px 2px fade(black, 20%) inset,
        0 0 0 6px #666 inset;
      border-radius: 50%;
    }
  }
  
  input {
    display: none;
    
    &:checked ~ .hole .switch {
      background-image:
      radial-gradient(ellipse at center, fade(white, 7%) 0%, transparent 80%),
      radial-gradient(ellipse at center, fade(black, 15%) 0%, transparent 80%),
      radial-gradient(ellipse at center, fade(#FEF400, 50%) 0%, fade(#FEF400, 20%) 30%, fade(#FEF400, 10%) 50%, transparent 80%),
      radial-gradient(ellipse at center, fade(black, 5%) 0%,  fade(black, 5%) 30%, transparent 50%),
      linear-gradient(to bottom, #B43222 0%, #A51810 100%);
      background-size: 100% 80px, 100% 80px, 100% 180px, 10px 10px, 100%;
      background-position: top left, bottom left, 0 30px, bottom left, center;
      background-repeat: no-repeat, no-repeat, no-repeat, repeat, no-repeat;
      border-radius: 8px;
      box-shadow:
        4px 0 1px fade(white, 15%) inset,
        -4px 0 1px fade(white, 15%) inset,
        0 4px 1px fade(white, 15%) inset,
        0 -12px 8px fade(black, 25%) inset,
        0 30px 8px fade(#801105, 50%),
        0 25px 8px fade(#801105, 30%),
        0 20px 8px fade(#801105, 40%),
        0 15px 8px fade(#801105, 50%),
        0 10px 8px fade(#801105, 60%),
        0 5px 8px fade(#801105, 90%);
      transform:
      perspective(1500px)
      rotateX(30deg)
      translateY(-16px);
      
      &:before {
        top: auto;
        bottom: -2px;
      }
      
      &:after {
        content: "";
        position: absolute;
        bottom: -24px;
        left: calc(50% - 36px);
        width: 96px;
        height: 16px;
        border-radius: 50%;
        background-image: radial-gradient(ellipse at center, #FEF400 0%, fade(#FEF400, 30%) 60%, transparent 100%);
        filter: blur(8px);
        
      }
      
      .one {
        background-image: linear-gradient(to bottom, #eee 0%, #aaa 100%);
      }
      
      .zero {
        box-shadow:
          0 4px 2px fade(white, 50%) inset,
          0 -4px 2px fade(black, 20%) inset,
          0 0 0 6px #aaa inset;
      }
    }
  }
}

body {
  background-color: #2B2B2B;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console