123

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
<input type="checkbox" name="btn" id="btn">
<label class="btn" for="btn"></label>

            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Gloria+Hallelujah);

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(center, ellipse cover, #b29f93 0%,#705f54 100%);
}

/* hide real input */
#btn {
  position: absolute;
  left:50%;
  z-index:-1;
  visibility: hidden;
}

.btn {
  width: 100px;
  height: 100px;
  display: block;
  border-radius: 10px;
  margin:0px auto;
  margin-top: 50px;
  user-select: none;   
  cursor:pointer;
  
  background: linear-gradient(top, #fff 0%,rgba(255,255,255,0.1) 3%),linear-gradient(bottom, #e9e4e0 0%,rgba(255,255,255,0.1) 3%), linear-gradient(top, #e5e0d8 0%,#f9f6f1 100%);
  
  box-shadow: 0px -3px 0px #d2cdc4, 0px 0px 0px 4px #777069, 0px -2px 0px 4px #777069, 0px 0px 0px 10px #f9f6f2, 0px -2px 0px 10px #f9f6f2, 0px 0px 0px 11px #f0ebe7, 0px -2px 0px 11px #f0ebe7, 0px 0px 0px 20px #f9f6f2, 0px 4px 1px 20px #e4e1dc, 0px -4px 0px 20px #fdfcfb, 0px 4px 20px 20px #000;
}

.btn:after {
  position: absolute;
  content: '';
  width: 25px;
  height: 8px;
  margin: 15px 37px;
	box-shadow: 0px 1px 3px rgba(0,0,0,0.4) inset, 0px 1px 0px #fff;
	border-radius: 15px;
	background: rgba(90, 90, 90, .35);
}

/* switch button: on + glow in the dark */
#btn:checked ~ .btn {
	background: linear-gradient(bottom, #e9e4e0 0%,rgba(255,255,255,0.1) 3%), linear-gradient(top, #e5e0d8 0%,#f9f6f1 100%);
  
	box-shadow: 0px -4px 0px #d2cdc4 inset, 0px -3px 0px #e5e0d8, 0px 0px 0px 4px #777069, 0px -2px 0px 4px #777069, 0px 0px 0px 10px #f9f6f2, 0px -2px 0px 10px #f9f6f2, 0px 0px 0px 11px #f0ebe7, 0px -2px 0px 11px #f0ebe7, 0px 0px 0px 20px #f9f6f2, 0px 4px 1px 20px #e4e1dc, 0px -4px 0px 20px #fdfcfb, 0px 4px 20px 20px #000, 150px 0 100px rgba(240, 240, 0, 0);
  
  animation: nightwatch 3.25s infinite ease-in -.85s;
}

@keyframes nightwatch {
  0%, 80%, 100% {
    box-shadow: 
      0px -3px 0px rgba(234, 230, 223, 1), 
      inset 0px -3px 0px rgba(210, 205, 196, .5), 
      0px 0px 0px 4px #777069, 
      0px -2px 0px 4px #777069, 
      0px 0px 0px 10px #f9f6f2, 
      0px -2px 0px 10px #f9f6f2, 
      0px 0px 0px 11px #f0ebe7, 
      0px -2px 0px 11px #f0ebe7, 
      0px 0px 0px 20px #f9f6f2, 
      0px 4px 1px 20px #e4e1dc, 
      0px -4px 0px 20px #fdfcfb, 
      0px 4px 20px 20px #000
    ;
  }
  50% {
    	box-shadow: 
      	0px -3px 0px rgba(234, 230, 223, 1), 
      	inset 0px -3px 0px rgba(210, 205, 196, .7), 
        0px 0px 0px 4px rgba(240, 240, 0, .75), 
        0px -2px 0px 4px rgba(119, 112, 105, .3), 
        0px 0px 0px 10px #f9f6f2, 
        0px -2px 0px 10px #f9f6f2, 
        0px 0px 0px 11px #f0ebe7, 
        0px -2px 0px 11px #f0ebe7, 
        0px 0px 0px 20px #f9f6f2, 
        0px 4px 1px 20px #e4e1dc, 
        0px -4px 0px 20px #fdfcfb, 
        0px 4px 20px 20px #000,
        0 0 200px rgba(240, 240, 0, .3), 
        0 0 200px rgba(240, 240, 0, .1),
        150px 0 150px -45px rgba(240, 240, 0, .225),
        -150px 0 150px -45px rgba(240, 240, 0, .225)
      ;
  }
}

/* switch button - led: on */
#btn:checked ~ .btn:after {
  margin: 14px 37px;
  background: rgba(248, 214, 8, .9);
  box-shadow: 
    inset 0px 1px 3px rgba(0,0,0,0.4), 
    0px 1px 0px #fff,
    0 0 3px rgba(248, 214, 8, .2),
    0 0 4px rgba(248, 214, 8, .2),
    0 0 5px rgba(248, 214, 8, .2),
    0 0 6px rgba(248, 214, 8, .2),
    0 0 7px rgba(248, 214, 8, .2)
  ;
}

/* bright room */
#btn:after {
  position:fixed;
  content:'';
  top:0;
  left:0;
  height:100%;
  width:100%;
  background: transparent;
  visibility: visible;
}

/* click */
#btn:before {
  position:absolute;
  content:'click!';
  left:150px;
  color:rgba(0, 0, 0 , .5);
 
  visibility: visible;
  font: 5em/1.15em 'Gloria Hallelujah', cursive;
}

/* dark room */
#btn:checked:after {
  background: rgba(0, 0, 0, .4);
}

#btn:checked:before {
  content:':D';
  color: rgba(248, 214, 8, .1);
  text-shadow: 
    0 0 4px rgba(248, 214, 8, .2),
    -2px -2px 6px rgba(248, 214, 8, .3),
    2px 2px 6px rgba(248, 214, 8, .3)
  ;
}
            
          
!
            
              //Inspired by http://dribbble.com/shots/693683-iOS-App-Icon-Switch?list=popular&offset=148

/**
  Forked: "Switch Button Single element" by "M Naufal"
  
  # What? #
	I added an input[type="checkbox"] and a label to enable
	a real "on/off" experience (e.g. "The Night")

	# 2012 by Tim Pietrusky
	# timpietrusky.com
**/


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

Console