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

Auto Save

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 id="off"></div>
<div id="on">drag me</div>
<div id="options">
  Options</br>
  <button id="light" class="buttonOn">Light</button>
  <button id="color">Color</button>
  <button id="blur">Blur</button> 
</div>
              
            
!

CSS

              
                		@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
html, body {
  margin:0;
  padding:0;
}
#off {
  background:#000 url(https://dl.dropboxusercontent.com/s/caginibqetx0tek/dark.jpg) left top no-repeat fixed;
  background-size:100% 100%;
  position:absolute;
  top:0;
  left:0;
  margin:0;
  padding:0;
  width:100%;
  height:100%;
  overflow:hidden;
}
#on{
  position:absolute;
  /* Text style within circle */
  font-family:'Open Sans',sans-serif;
  font-weight:400;
  font-size:2em;
  text-align:center;
  /* Line height on text vertical aligns text */
  line-height:250px;
  color:#F00;
  /* Position and size of circle */
  top:50px;
  left:50px;
  height:250px;
  width:250px;
  /* FIXED background of color image of body background */
  background:url(https://dl.dropboxusercontent.com/s/suwggo9d7sced15/light.jpg) left top no-repeat fixed;
  background-size:100% 100%;
  /* Border Radius half the width and height to make a circle */
  -webkit-border-radius: 175px;
  -moz-border-radius: 175px;
  border-radius: 175px;
  /* Inset box shadow to make color image appear to be underneath the circle */
  -moz-box-shadow: 5px 5px 10px 0px rgba(0,0,0,.5) inset; 
  -webkit-box-shadow: 5px 5px 10px 0px rgba(0,0,0,.5) inset;            
  box-shadow: 5px 5px 10px 0px rgba(0,0,0,.5) inset;
  text-shadow:1px 1px 0px #000;
  /* Move icon gives direction */
  cursor:move;
}
#options{
  position:fixed;
  top:20px;
  right:20px;
  width:80px;
  font-family:'Open Sans',sans-serif;
  text-shadow:0px 1px 0px rgba(255,255,255,.2);
  font-weight:700;
  font-size:1em;
  color:#000;
  text-align:center;
  background-color:rgba(204,204,204,.8);
  padding:5px 10px 10px 10px;
  -webkit-border-radius: 6px;
  -moz-border-radius: 6px;
  border-radius: 6px;
  -moz-box-shadow: 0px 5px 10px 0px rgba(0,0,0,.8); 
  -webkit-box-shadow: 0px 5px 10px 0px rgba(0,0,0,.8);            
  box-shadow: 0px 5px 10px 0px rgba(0,0,0,.8);
}


.buttonOn,.buttonOn:hover,.buttonOn:active{
  background-color:rgba(255,204,0,.8);
  border:1px #FFCC00 solid;
  text-shadow:0px 1px 0px rgba(255,255,255,.4);
  color:#000;
  -moz-box-shadow: none;
  -webkit-box-shadow: none;
  box-shadow: none;
  cursor:default;
}

button{
  display:block;
  font-family:'Open Sans',sans-serif;
  font-weight:400;
  font-size:1em;
  color:#000;
  background-color:rgba(255,255,255,.3);
  margin-top:10px;
  -webkit-border-radius: 6px;
  -moz-border-radius: 6px;
  border-radius: 6px;
  border:1px #000 solid;
  padding:5px 10px;
  outline:none;
  text-shadow:0px 1px 0px rgba(255,255,255,.2);
  width:80px;
}
button:hover{
  background-color:rgba(255,255,255,.7);
  color:#000;
  border:1px #FFF solid;
  cursor:pointer;
  text-shadow:2px 2px 0px transparent;
}
button:active{
  background-color:rgba(0,0,0,.5);
  color:#FFF;
  border:1px #000 solid;
  cursor:pointer;
  text-shadow:-1px -1px 0px rgba(0,0,0,.7);
  -moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,.7) inset; 
  -webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,.7) inset;            
  box-shadow: 2px 2px 5px 0px rgba(0,0,0,.5) inset;
}
              
            
!

JS

              
                
		$(function(){
  $off = $('#off');
  			$on = $('#on').draggable({containment:$off});
      $light = $('#light').on('click',function(){
        if(!$(this).hasClass('buttonOn')){
          $('button').removeClass('buttonOn');
          $(this).addClass('buttonOn');
          $on
            .css('background','url(https://dl.dropboxusercontent.com/s/suwggo9d7sced15/light.jpg) left top no-repeat fixed')
            .css('color','#F00')
            .css('background-size','100% 100%');
          $off
            .css('background','#000 url(https://dl.dropboxusercontent.com/s/caginibqetx0tek/dark.jpg) left top no-repeat fixed')
            .css('background-size','100% 100%');
        }
      });
      $color = $('#color').on('click',function(){
        if(!$(this).hasClass('buttonOn')){
          $('button').removeClass('buttonOn');
          $(this).addClass('buttonOn');
          $on
            .css('background','url(https://dl.dropboxusercontent.com/s/agv5idk1mjrcxbh/color.jpg) left top no-repeat fixed')
            .css('color','#00F')
            .css('background-size','100% 100%');
          $off
            .css('background','#000 url(https://dl.dropboxusercontent.com/s/ll17fqmkham1ekx/bw.jpg) left top no-repeat fixed')
            .css('background-size','100% 100%');
        }
      });
      $blur = $('#blur').on('click',function(){ 
        if(!$(this).hasClass('buttonOn')){
          $('button').removeClass('buttonOn');
          $(this).addClass('buttonOn');
          $on
            .css('background','url(https://dl.dropboxusercontent.com/s/ndom3c7e3s8pf60/bg_clear.jpg) left top no-repeat fixed')
            .css('color','#FC0')
            .css('background-size','100% 100%');
          $off
            .css('background','#000 url(https://dl.dropboxusercontent.com/s/jrvpj3ol83ps8wh/bg_blur.jpg) left top no-repeat fixed')
            .css('background-size','100% 100%');
        }
      });
		})

              
            
!
999px

Console