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 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

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

              
                <p>This text will be normal. <span id="italicize">But this will be italicized!</span></p>

<p id="tooMuch" class="italic fancy underlined">Sometimes you can have too much class.</p>

<p id="howMany" class="bold blue italic">This paragraph element has <span id="classCount"></span> classes</p>

<button id="greeter">Click for a greeting</button>
<p id="greeting" class="hide italic">Hello!</p>


              
            
!

CSS

              
                .blue { color: blue; }
.bold { font-weight: bold; }
.fancy { font-family: cursive; }
.hide { display: none; }
.italic { font-style: italic; }
.underlined { text-decoration: underline; }
              
            
!

JS

              
                // find element with id italicize, add italic class 
document.getElementById('italicize').classList.add('italic'); 

// find element with id 'tooMuch', remove the fancy class 
document.getElementById('tooMuch').classList.remove('fancy');

// find the paragraph with the id howMany and count its classes
var classCounter = document.getElementById('howMany').classList.length;
// find the element with the id classCount and set its text to show how many classes the #howMany element has 
document.getElementById('classCount').textContent = classCounter;

// when the greeter button is clicked, toggle the 'hide' class on the greeting paragraph.
var greeterButton = document.getElementById('greeter');
greeterButton.onclick = function() {
  document.getElementById('greeting').classList.toggle('hide');
}
              
            
!
999px

Console