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

              
                <div class="container">
  <p>
    Lets imagine we're building a content box with a sticky
    footer (just for the box, not our whole site). Not that
    this is the only way to do it, but we are using absolute
    positioning for the gray footer. Perhaps we're going to 
    add scrolling to the white content area later.
  </p><p>
    The problem is that
    it hangs over the container. The reason is because of
    <code>width: 100%</code> and box-sizing turned off. Or,
    with or without box-sizing, we can
    do <code>left: 0; right: 0;</code>
  </p>
  <footer>My Footer (with a width of 100%)</footer>
</div>
              
            
!

CSS

              
                body {
  background-color: #eee;
  margin: 1em;
}

.container {
  max-width: 500px;
  background-color: #fff;
  padding: 1em;
  padding-bottom: 3em; // offsets footer
  position: relative;
  height: 180px;
}

.container > footer {
  background-color: #444;
  color: #aaa;
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  padding: 1em;
}

.container:hover > footer {
  width: auto;
  right: 0;
}

// Note that the only reason why I don't have the box-sizing as appart of my reset, is so I can toggle it with hover.
              
            
!

JS

              
                
              
            
!
999px

Console