Pen Settings

HTML

CSS

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

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

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.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                console.clear();

// This function is declared below, but at runtime it is hoisted to the top.
// This ensures that it's available to run, similar to PHP
foo();

function foo() {
  console.log( 'bar' );
}


// The myName variable is declared below and hoisted aboove, but it is not assigned before it is used, so is `undefined`
console.log( 'Hello ' + myName );
var myName = 'World';



// Both are declared and hoisted.
// Only one is defined before use. 
// JavaScript does not hoist assignments, only declarations
var a = "William"; // Initialize a
console.log( "Hello " + a + " " + b ); // 'Hello William undefined'
var b = "Earnhardt"; // Initialize b



// Both vars are declared, with city being declared after. Both are hoisted.
// Both are assigned before they are used
var event = "WordCamp"; // Declare & initialize event
city = "Sacramento"; // Initialize city
console.log( event + " " + city ); // WordCamp Sacramento
var city; // Declare city



// Both declared after use and hoisted
// Both assigned before being used
first = 'William'; // Initialize first
last = 'Earnhardt'; // Initialize last
console.log( first + " " + last ); // 'William Earnhardt'
var first, last; // Declare both first & last for hoisting
              
            
!
999px

Console