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.


                <div id="container">
  <!-- content views end up here -->

<!-- Handles Navigation -->
<div id="nav">
  <a id="link-a" href="#">AAAAA</a>
  <a id="link-b" href="#">BBBBB</a>
  <a id="link-c" href="#">CCCCC</a>

<!-- These content views will be removed and added via navigation links -->
<div id="a" class="box"></div>
<div id="b" class="box"></div>
<div id="c" class="box"></div>


                body, html {
  margin: 0;
  height: 100%;

#container {
  width: 100%;
  height: 100%;
  background: lightgray;
  position: relative;

#nav {
  position: fixed;
  left: 20px;
  top: 20px;

#link-a, #link-b, #link-c {
  display: inline-block;
  padding: 1em;
  color: white;
  background: black;
  text-decoration: none;

.box {
  width: 100%;
  height: 100%;
  position: absolute;

#a {
  background: cyan;

#b {
  background: yellow;

#c {
  background: magenta;


                // Content views 
var a = $("#a"); // make a reference to  each content view
var b = $("#b");
var c = $("#c");

// Remove the content views

// Keep track of the current content view
var currentView;

// This method shows a content 
function showView(newView) {
  // Check if there is a current view
  if (currentView) {
    // Animate the current view off the screen.
    currentView.animate({left:"-100%"}, 400, function() {
      // Remove the current view.
  // Show New View
  currentView = newView;
 currentView.css({left:"100%"}).animate({left:0}, 400, function(){
   //  Use  could use this to execute a callback when the new view appears...

// These links show a new view by calling showView() and 
// passing in the new view object.