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 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

              
                <div class="switches">
  <div class="switch on">
    
  </div>
  <div class="switch">
    
  </div>
</div>
              
            
!

CSS

              
                .switches {
  height: 120px;
  margin: 60px auto;
  width: 200px;
  padding: 4px 2px;
  background: #5B554F;
  box-shadow: inset 0 2px 8px 1px black;
  border-radius: 4px;
  position: relative;
}
.switches:before {
  content:"";
  position: absolute;
  left: -25px;
  top: -35px;
  width: 100%;
  height: 100%;
  z-index: -1;
  padding: 35px 25px;
  background-image: -webkit-gradient(linear, 0 0, 305 0, from(#796c62), color-stop(0.009, #cec8c2), color-stop(0.013, #e2ddd9), color-stop(0.032, #f5f3f0), color-stop(0.977, #f4f1ef), color-stop(0.996, #7a6d63), to(#7a6d63));
background-image: -webkit-linear-gradient(360deg, #796c62, #cec8c2 0%, #e2ddd9 1.3%, #f5f3f0 3.2%, #f4f1ef 97.7%, #7a6d63 100%, #7a6d63);
background-image: -moz-linear-gradient(360deg, #796c62, #cec8c2 0%, #e2ddd9 1.3%, #f5f3f0 3.2%, #f4f1ef 97.7%, #7a6d63 100%, #7a6d63);
background-image: -o-linear-gradient(360deg, #796c62, #cec8c2 0%, #e2ddd9 1.3%, #f5f3f0 3.2%, #f4f1ef 97.7%, #7a6d63 100%, #7a6d63);
background-image: linear-gradient(90deg, #796c62, #cec8c2 0%, #e2ddd9 1.3%, #f5f3f0 3.2%, #f4f1ef 97.7%, #7a6d63 100%, #7a6d63);
  box-shadow: 0 1px 3px 5px rgba(0,0,0,.5),
      inset 0 1px 0 white;
    border-radius: 2px;
}
.switches:after {
  content: "";
  position: absolute;
  bottom: -35px;
  z-index: -2;
  left: -2%;
  width: 104%;
  box-shadow: 
    0 1px 4px 12px rgba(0,0,0,.8);
}
.switch {
  float: left;
  width: 48%;
  margin: 0 1%;
  height: 100%;
  background-image: -webkit-gradient(linear, 0 0, 0 119, color-stop(0.016, #e9e2df), color-stop(0.949, #d1c3bb), to(#b4a69f));
  background-image: -webkit-linear-gradient(#e9e2df 1.6%, #d1c3bb 94.9%, #b4a69f);
  background-image: -moz-linear-gradient(#e9e2df 1.6%, #d1c3bb 94.9%, #b4a69f);
  background-image: -o-linear-gradient(#e9e2df 1.6%, #d1c3bb 94.9%, #b4a69f);
  background-image: linear-gradient(#e9e2df 1.6%, #d1c3bb 94.9%, #b4a69f);
  box-shadow: 
    inset 0 10px rgba(255,255,255,.7),
    inset 0 11px 1px rgba(250,250,250,.2),
    inset 0 -2px 1px rgba(0,0,0,.2);
  border-radius: 2px;
  position: relative;
  z-index: 1;
}
.switch:before {
  content: "";
  background: rgba(0,0,0,.1);
  width: 36%;
  position: absolute;
  height: 4px;
  margin: 16px 32%;
  border-radius: 12px;
  box-shadow: inset 0 0 1px rgba(0,0,0,.2);
  border: 1px solid rgba(0,0,0,.1);
}
.switch:after{
  content:"";
  position:absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 20%;
  background: -moz-linear-gradient(top,  rgba(65,50,0,0.25) 0%, rgba(65,50,0,0.25) 1%, rgba(65,50,0,0) 68%, rgba(65,50,0,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(65,50,0,0.25)), color-stop(1%,rgba(65,50,0,0.25)), color-stop(68%,rgba(65,50,0,0)), color-stop(100%,rgba(65,50,0,0)));
background: -webkit-linear-gradient(top,  rgba(65,50,0,0.25) 0%,rgba(65,50,0,0.25) 1%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
background: -o-linear-gradient(top,  rgba(65,50,0,0.25) 0%,rgba(65,50,0,0.25) 1%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
background: -ms-linear-gradient(top,  rgba(65,50,0,0.25) 0%,rgba(65,50,0,0.25) 1%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
background: linear-gradient(to bottom,  rgba(65,50,0,0.25) 0%,rgba(65,50,0,0.25) 1%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
  border-radius: 2px;
}
.on.switch {
  background-image: -webkit-gradient(linear, 0 0, 0 111, color-stop(0.018, #fff), color-stop(0.018, #f7f6f5), color-stop(0.99, #eee6e2), color-stop(0.99, #f0ece8), to(#f0ece8));
  background-image: -webkit-linear-gradient(#fff 1.8%, #f7f6f5 1.8%, #eee6e2 99%, #f0ece8 99%, #f0ece8);
  background-image: -moz-linear-gradient(#fff 1.8%, #f7f6f5 1.8%, #eee6e2 99%, #f0ece8 99%, #f0ece8);
  background-image: -o-linear-gradient(#fff 1.8%, #f7f6f5 1.8%, #eee6e2 99%, #f0ece8 99%, #f0ece8);
  background-image: linear-gradient(#fff 1.8%, #f7f6f5 1.8%, #eee6e2 99%, #f0ece8 99%, #f0ece8);
  box-shadow: none;
  box-shadow: 
    inset 0 -13px 2px rgba(255,255,255,1);
}
.on.switch:before {
  margin-top: 10px;
  background: orange;
  box-shadow: 
    inset 0 1px rgba(255,255,255,.2),
    0 0 2px orange;
}
.on.switch:after{
  content:"";
  position:absolute;
  top: 90%;
  left: 0;
  width: 100%;
  height: 50%;
  background: -moz-linear-gradient(top,  rgba(65,50,0,0.3) 0%, rgba(65,50,0,0.3) 35%, rgba(65,50,0,0) 68%, rgba(65,50,0,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(65,50,0,0.3)), color-stop(35%,rgba(65,50,0,0.3)), color-stop(68%,rgba(65,50,0,0)), color-stop(100%,rgba(65,50,0,0)));
background: -webkit-linear-gradient(top,  rgba(65,50,0,0.3) 0%,rgba(65,50,0,0.3) 35%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
background: -o-linear-gradient(top,  rgba(65,50,0,0.3) 0%,rgba(65,50,0,0.3) 35%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
background: -ms-linear-gradient(top,  rgba(65,50,0,0.3) 0%,rgba(65,50,0,0.3) 35%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
background: linear-gradient(to bottom,  rgba(65,50,0,0.3) 0%,rgba(65,50,0,0.3) 35%,rgba(65,50,0,0) 68%,rgba(65,50,0,0) 100%);
  border-radius: 2px;
}
/*background styles
  -- bg noise from:
  https://coderwall.com/p/m-uwvg
*/
body {
  background: #1b1003;
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiY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NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
  position: relative;
}
.radial:before{
  content:"";
  position:absolute;
  top:-160px;
  width: 1200px;
  max-width: 100%;
  height: 400px;
  background: -moz-radial-gradient(center, ellipse cover,  rgba(255,255,255,0.15) 1%, rgba(255,255,255,0.15) 2%, rgba(255,255,255,0) 56%, rgba(255,255,255,0) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(1%,rgba(255,255,255,0.15)), color-stop(2%,rgba(255,255,255,0.15)), color-stop(56%,rgba(255,255,255,0)), color-stop(100%,rgba(255,255,255,0)));
background: -webkit-radial-gradient(center, ellipse cover,  rgba(255,255,255,0.15) 1%,rgba(255,255,255,0.15) 2%,rgba(255,255,255,0) 56%,rgba(255,255,255,0) 100%);
background: -o-radial-gradient(center, ellipse cover,  rgba(255,255,255,0.15) 1%,rgba(255,255,255,0.15) 2%,rgba(255,255,255,0) 56%,rgba(255,255,255,0) 100%);
background: -ms-radial-gradient(center, ellipse cover,  rgba(255,255,255,0.15) 1%,rgba(255,255,255,0.15) 2%,rgba(255,255,255,0) 56%,rgba(255,255,255,0) 100%);
background: radial-gradient(ellipse at center,  rgba(255,255,255,0.15) 1%,rgba(255,255,255,0.15) 2%,rgba(255,255,255,0) 56%,rgba(255,255,255,0) 100%);
  z-index: -1;
}
.light {
  background: #4b4033;
}
              
            
!

JS

              
                /*/ CSS Switch
/// =======================
/// My first pen, made to practice using CSS properties for aestethics. This switch was made losely modelling the switch in this Dribbble post:

http://dribbble.com/shots/881352-Switch
*/

$(".switch").bind("click",function(){
  $(this).toggleClass("on");
  
  if($(this).index() == 0)
    $("body").toggleClass("radial");
  else if($(this).index() == 1)
    $("body").toggleClass("light");
});

$("body").addClass("radial");
              
            
!
999px

Console