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.


    <title>Site Title</title>
    <div class="actions">
      <button onclick="modify()">Modify second list item</button>
    <button onclick="insertEnd()">Insert fourth list item</button>
    <button onclick="insertBetween()">Insert paragraph element between the existing ones</button>
    <div class="main-body">
      <h1>Article Heading</h1>
      <p>The second list item will change 5 seconds after the page loads.  Refresh the page to see it again if you missed it.</p>
      <p>Some more text</p>
        <li>List item 1</li>
        <li>List item 2</li>
        <li>List item 3</li>
    <div class="footer">
      <p>Site created by Zach</p>


                .actions {
  display: flex;

.actions button {
  margin: 3px;

.actions button:hover {
  cursor: pointer;


                function modify() {
  const list = document.querySelector('ul');
  // Remember, arrays are "zero-indexed"
  const secondListItem = list.children.item(1);
  secondListItem.textContent = 'a new value';

function insertEnd() {
  const list = document.querySelector('ul');
  const newItem = document.createElement('li');
  newItem.textContent = 'new item';

function insertBetween() {
  // Step 1: Find the element we want to insert something after
  const mainBody = document.querySelector('.main-body');
  const pItems = mainBody.querySelectorAll('p');
  const secondParagraphElem = pItems.item(1);

  // Step 2: Create the element we want to insert
  const newElem = document.createElement('p');
  newElem.textContent = 'some inserted text';

  // Step 3: Insert the element
  mainBody.insertBefore(newElem, secondParagraphElem);