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

              
                  <header><h2>Sticky Footer with Flexbox</h2></header>
  <main>
    <button>Add Paragraph</button> <button>Remove Paragraph</button>
    <p>This page is using a typical header/footer combo. The footer is positioned using flexbox so that it stays at the bottom of the page even if the content doesn't fill the entire page vertically. If this content goes past the length of the page, the footer will behave like a regular footer and will continue to get pushed down. Therefore it will only stay at the bottom of the viewport when the content is less than the height of the viewport. Use the buttons above to add or remove extra paragraphs so you can see how the footer responds.</p>
  </main>
  <footer><h2>Sticky Footer</h2></footer>
              
            
!

CSS

              
                body {
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

p {
  text-align: left;
  padding: 0 20px;
}

code {
  color: firebrick;
}

header, footer {
  flex-basis: auto;
  flex-grow: 0;
  flex-shrink: 0;
  background: #ccc;
  padding: 5px;
  text-align: center;
}

main {
  flex-basis: auto;
  flex-shrink: 1;
  flex-grow: 1;
  text-align: center;
  padding: 14px;
}

button {
  padding: 7px 10px;
  margin: 0 0 8px 0;
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }
}
              
            
!

JS

              
                document.querySelector('button').addEventListener('click', function () {
  document.querySelector('main')
          .appendChild(document.querySelector('p').cloneNode(true));
}, false);

document.querySelectorAll('button')[1].addEventListener('click', function () {
  if (document.querySelectorAll('p')[1]) {
    document.querySelector('p').remove();
  }
          
}, false);

              
            
!
999px

Console