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 is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.


      button#addBtn ADD Item
      button#changeBtn Change Item Text
      - n = 1
        while n <= 3
          li= `list-${n++}`
      b log


  display: inline-block
  line-height: 2em
  max-width: 230px
  width: 45%

  border: 1px solid #ededed
  background: #eee
  padding: 1em
  margin: 1em auto
  max-width: 960px

  display: flex
  width: 100%
  width: 50%


              const d = document;
const list = d.getElementById('list');
const nodelist = list.querySelectorAll('li');
const collection = list.children;

function printText(text) {
  const pre = d.getElementById('pre');
  if(pre.textContent) {
    text += "\n----\n"
  pre.textContent = text + pre.textContent;

function listNum() {
  const text = [


const addBtn = d.getElementById('addBtn');
const changeBtn = d.getElementById('changeBtn');

addBtn.addEventListener('click', function(evt) {
  const n = list.dataset.num - 0 + 1;
  const li = d.createElement('li');
  li.textContent = `list-${n}`;
  list.dataset.num = n;

changeBtn.addEventListener('click', function(evt) {
  const listNum = list.dataset.num - 0;
  const n = Math.floor(Math.random() * listNum);
  //const n = list.children.length - 1;
  const li = list.children[n];
  const editNum = li.dataset.change - 0 || 0
  li.dataset.change = editNum + 1;
  li.textContent = `list-${n + 1}-${editNum + 1}: ${}`;
  const text = [nodelist, collection].map((arg, i) => {
    const name = i? 'HTMLCollection' : 'NodeList';
    if(arg[n]) {
      const data = arg[n];
      return `${data.textContent} (${name})`;
    } else {
      return `list-${n+1} is undefined (${name})`;