cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="wrap">
  
  <input type="checkbox" id="s1" />
  <label class="slider-v1" for="s1"></label>

  <input type="checkbox" id="s2" checked="" />
  <label class="slider-v1" for="s2"></label>
  
</div><!--/wrap-->
<div class="wrap">
  
  <input type="checkbox" id="s3" />
  <label class="slider-v2" for="s3"></label>
  
  <input type="checkbox" id="s4" checked="" />
  <label class="slider-v2" for="s4"></label>
  
</div><!--/wrap-->
<div class="wrap">
  
  <input type="checkbox" id="s5" />
  <label class="slider-v3" for="s5"></label>
  
  <input type="checkbox" id="s6" checked="" />
  <label class="slider-v3" for="s6"></label>
  
</div><!--/wrap-->
            
          
!
            
              @import "compass/css3";

html,body { height:100% }
body { background:linear-gradient(#f7f7f7,#e0e0e0); margin:0 }
.wrap { position:relative; width:33.33%; margin:-72px 0; top:50%; float:left }
label { margin:1.5em auto }
input { position:absolute; left:-9999px }

// **** ==== Slider v1: ==== **** //

// ********** Background:
.slider-v1 {
  position: relative; display: block;
  width: 5.5em; height: 3em;
  cursor: pointer;
  border-radius: 1.5em;
  transition: 350ms;
  background: linear-gradient(rgba(#000,0.07),rgba(#fff,0)),#ddd;
  box-shadow:
    0 0.07em 0.1em -0.1em rgba(#000,.4) inset,
    0 0.05em 0.08em -0.01em rgba(#fff,.7);
}

// ********** Switch:
.slider-v1::before {
  position: absolute; content:'';
  width: 2em; height: 2em;
  top: 0.5em; left: 0.5em;
  border-radius: 50%;
  transition: 250ms ease-in-out;
  background: linear-gradient(#f5f5f5 10%,#eee);
  box-shadow:
    0 0.1em 0.15em -0.05em rgba(#fff,.9
    ) inset,
    0 0.5em 0.3em -0.1em rgba(#000,.25);
}

// ********** Markers:
.slider-v1::after {
  position: absolute; content:'';
  width: 1em; height: 1em;
  top: 1em; left: 6em;
  border-radius: 50%;
  transition: 250ms ease-in;
  background: linear-gradient(rgba(#000,0.07),rgba(#fff,0.1)),#ddd;
  box-shadow:
    0 0.08em 0.15em -0.1em rgba(#000,.5) inset,
    0 0.05em 0.08em -0.01em rgba(#fff,.7),
    -7.25em 0 0 -0.25em rgba(#000,.3);
}

input:checked + .slider-v1::after {
  background: linear-gradient(rgba(#000,0.07),rgba(#fff,0.1)),#4c6;
  box-shadow:
    0 0.08em 0.15em -0.1em rgba(#000,.5) inset,
    0 0.05em 0.08em -0.01em rgba(#fff,.7),
    -7.25em 0 0 -0.25em rgba(#000,.12);
}

input:checked + .slider-v1::before {
	left: 3em;
}

// **** ==== Slider v2 ==== **** //

// ********** Background:
.slider-v2 {
  position: relative; display: block;
  width: 5.5em; height: 3em;
  cursor: pointer;
  border-radius: 1.5em;
  transition: 350ms;
  background: linear-gradient(rgba(#000,0.07),rgba(#fff,0)),#ddd;
  box-shadow:
    0 0.07em 0.1em -0.1em rgba(#000,.4) inset,
    0 0.05em 0.08em -0.01em rgba(#fff,.7);
}

// ********** Switch:
.slider-v2::after {
  position: absolute; content:'';
  width: 2em; height: 2em;
  top: 0.5em; left: 0.5em;
  border-radius: 50%;
  transition: 250ms ease-in-out;
  background: linear-gradient(#f5f5f5 10%,#eee);
  box-shadow:
    0 0.1em 0.15em -0.05em rgba(#fff,.9
    ) inset,
    0 0.2em 0.2em -0.12em rgba(#000,.5);
}

// ********** Channel:
.slider-v2::before {
  position: absolute; content:'';
  width: 4em; height: 1.5em;
  top: 0.75em; left: 0.75em;
  border-radius: 0.75em;
  transition: 250ms ease-in-out;
  background: linear-gradient(rgba(#000,0.07),rgba(#fff,0.1)),#d0d0d0;
  box-shadow:
    0 0.08em 0.15em -0.1em rgba(#000,.5) inset,
    0 0.05em 0.08em -0.01em rgba(#fff,.7),
    0 0 0 0 rgba(#4c6,.7) inset;
}

input:checked + .slider-v2::before {
  box-shadow:
    0 0.08em 0.15em -0.1em rgba(#000,.5) inset,
    0 0.05em 0.08em -0.01em rgba(#fff,.7),
    3em 0 0 0 rgba(#4c6,.7) inset;
}

input:checked + .slider-v2::after {
	left: 3em;
}

// **** ==== Slider v3 ==== **** //

// ********** Background:
.slider-v3 {
  position: relative; display: block;
  width: 7em; height: 3em;
  cursor: pointer;
  border-radius: 1.5em;
  transition: 350ms;
  background: #ddd;
}

// ********** Switch:
.slider-v3::after {
  position: absolute; content:'';
  width: 2em; height: 2em;
  top: 0.5em; left: 0.5em;
  border-radius: 1.5em;
  transition:
    width 200ms ease-out,
    height 300ms 50ms ease-in,
    top 300ms 50ms ease-in,
    left 250ms 50ms ease-in,
    background 300ms ease-in,
    box-shadow 300ms ease-in;
  background: #f2f2f2;
  box-shadow: 0 0 0 1.5em #f2f2f2 inset;
}

input:checked + .slider-v3::after {
  width: 4em; height: 3em;
	top: 0; left: 3em;
  background: #4c6;
  box-shadow: 0 0 0 0 #f2f2f2 inset;
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console