Pen Settings



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


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.


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.


  <div id="frame">
    <div class="window"></div>
    <p class="label"></p>

    <div class="window"></div>
    <p class="label"></p>
    <br />

    <div class="window"></div>
    <p class="label"></p>

    <div class="window"></div>
    <p class="label"></p>


                @import url(;

* { box-sizing:border-box; } 
body { background-color: #795342;}
#frame { margin: 10px; }
section { display: inline-block; border: 10px solid #684D41; border-style: inset; margin: 10px 5px; background-color: #1B1515;}
.window { width: 200px; height: 200px; padding: 50px; background-color: cyan; }
.label { color: #DCD3CE; font-family: 'Cedarville Cursive', cursive; font-size: 30px; padding: 0; margin: 0 0 20px; text-align: center;}



      /*** init variables ***/

      // just a bucket of things
      var things = [
        { module: 'sky', label: 'the sky' },
        { module: 'bells', label: 'a bell' },
        { module: 'bilboquet', label: 'a bilboquet' },
        { module: 'apple', label: 'an apple' },
        { module: 'hat', label: 'a hat'},
        { module: 'javascript', label: 'a javascript' },
        { module: 'sign', label: 'the sign' },
        { module: 'rooster', label: 'a rooster' }

      var sections = document.getElementsByTagName('section');

      // keep track of each window/label used
      var usedGoods = [];
      var randomCorrectWindowId = Math.floor(Math.random() * 4);

      /*** helper functions ***/

      // returns id of object not yet used
      var generateRandomThing = function() {

        var usableId;
        var need = true;

        while ( need ) {
          usableId = Math.floor(Math.random() * things.length);

          // if x is not in usedGoods, set need to false and set as used
          if ( usedGoods.indexOf(usableId) === -1 ) {
            need = false;

        return usableId;

      /*** let's generate some friggin art ***/

      // for each section
      var sectionList =;
      sectionList.forEach(function(elem, i){
        // generate random window and label to use
        var windowId = generateRandomThing();
        var labelId;
        if (i === randomCorrectWindowId) {
          labelId = windowId;
        else {
          labelId = generateRandomThing();

        var window = elem.getElementsByClassName('window')[0];
        window.innerHTML = things[windowId].module;
        var label = elem.getElementsByClassName('label')[0];
        label.innerHTML = things[labelId].label;