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


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


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.


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.


                <div class="boxes">
  <input id="box0" type="checkbox" />
  <input id="box1" type="checkbox" />
  <input id="box2" type="checkbox" />
  <input id="box3" type="checkbox" />
  <input id="box4" type="checkbox" />
  <input id="box5" type="checkbox" />
  <input id="box6" type="checkbox" />
  <input id="box7" type="checkbox" />
  <input id="box8" type="checkbox" />
  <input id="box9" type="checkbox" />


                input[type=checkbox] {
   display: block;
   margin: 10px;


                //Set up out lastBox variable, lastBox is one of the extermities.
var lastBox = -1;

//Selects a range of checkboxes if it can. elm is a event object.
function selectRange(elm) {
  //Set up some variables so we can select some checkboxes!
  var newId = parseInt("box", ""));
  var checkboxes = document.querySelectorAll(".boxes input[type=checkbox]");
  //Swap lastBox and newId if lastBox is larger
  if (lastBox > newId) {
    var hold = newId;
    newId = lastBox;
    lastBox = hold;
  //Check if there's a starting pointer and that shift is being held
  if (lastBox != -1 && elm.shiftKey == true) {
    //Start at the lastBox element and check every box until the newId element.
    for (var i=lastBox; i<=newId; i++)
      checkboxes[i].checked = true;
    lastBox = -1;
  } else
    //If it's not, set lastBox to the current element id.
    lastBox = parseInt("box", ""));

//Get all the checkboxes
var boxes = document.querySelectorAll(".boxes input[type=checkbox]");
//Loop through them all and give them an event listener [NB: There's probably a better way to do this!]
for (var i = 0; i<boxes.length; i++)
  boxes[i].addEventListener('click', selectRange, true);