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

              
                <head>
  <title>Just a Normal Page</title>
</head>

<body>
  <h1 id="mainHeading">The Old H1 Heading</h1>

  <p>This is a simple demonstration of how you can navigate the DOM and locate an element on the page and then change the element using JavaScript.</p>
  <p>When you look at the red title above you see that it is not the text in the h1 tag of the HTML. The original text was, "The Old H1 Heading."  It has been replaced by the JavaScript.</p>
  <p>So, what happened? The JavaScript navigates the DOM looking for the element that has an ID of "mainHeading." Once it finds its on the web page it stores it in the variable called, "headline."</p>
  <p>It then changes the html of the variable to a string, "Wow, a New H1 Heading!"</p>

</body>
              
            
!

CSS

              
                h1 {
  color: red;
}
              
            
!

JS

              
                var headline = document.getElementById("mainHeading");
headline.innerHTML = "Wow, a New H1 Heading!";
              
            
!
999px

Console