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

              
                <button is="column-view-back" for="columnView">back</button>
<column-view id="columnView" ondata="source"></column-view>
              
            
!

CSS

              
                column-view {
  height: 300px;
  font-size: 10pt;
  font-family: "Arial";
  transition: border linear 0.2s, box-shadow linear 0.2s;
  display: block;
}

column-view:focus {
  /* nicer focus outline */
  outline: 0;
  border-color: #83AFD1;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
}

column-view li {
  line-height: 1.1em;
}

column-view .preview {
  padding: 10px;
}

column-view .preview h2 {
  margin-top: 0;
}

column-view .empty {
  height: 300px;
  background-color: #EEE;
  text-align: center;
  font-weight: bold;
  line-height: 300px;
}

              
            
!

JS

              
                function sourceEvent(value, cb) {
  var event = data.events[value.slice(1)]
  var div = document.createElement("div");
  div.classList.add("preview");
  div.innerHTML = "<h2>"+event.name+"</h2>"+event.type+"<br />"+event.lecturer+"<br /><p>"+event.description+"</p>";
  cb({dom: div});
}

function sourceNode(value, cb) {
  var node = data.tree[value];
  var childIDs = node[1];
  if (childIDs.length == 0) {
    sourceEmpty(value, cb);
    return;
  }

  var children = childIDs.map(function(id) {
    if (!node[2]) {
      var n = data.tree[id];
      var value = id;
      return {name : n[0], value: value};
    } else {
      var n = data.events[id];
      var value = "e" + id;
      return {name : n.name, value: value};
    }
  })
  children.sort(compareItems);
  cb({items: children});
}

function sourceEmpty(value, cb) {
  var div = document.createElement("div");
  div.classList.add("empty");
  div.innerHTML = "no items";
  cb({dom: div});
}

function source(value, cb) {
  if (!value) value = data.rootID;
  var sourceFn = value[0] == 'e' ? sourceEvent : sourceNode;
  sourceFn(value, cb);
};

function compareItems(a, b) {
  if (a.name > b.name)
    return 1;
  if (a.name < b.name)
    return -1;
  return 0;
}

              
            
!
999px

Console