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

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

              
                .site-wrapper
  header Header
  main
    h1 Flexbox Sticky Footer Example
    p When the main content area takes up less space than the viewport height, the footer will stick to the bottom. After the content exceeds the viewport height, the footer will be pushed accordingly.
    input(type="checkbox" id="show-content")
    label(for="show-content") Show more content
    div.main-content
      p It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small.

      p Never in all their history have men been able truly to conceive of the world as one: a single sphere, a globe, having the qualities of a globe, a round earth in which all the directions eventually meet, in which there is no center because every point, or none, is center — an equal earth which all men occupy as equals. The airman's earth, if free men make it, will be truly round: a globe in practice, not in theory.

      p If you could see the earth illuminated when you were in a place as dark as night, it would look to you more splendid than the moon.

      p As we got further and further away, it [the Earth] diminished in size. Finally it shrank to the size of a marble, the most beautiful you can imagine. That beautiful, warm, living object looked so fragile, so delicate, that if you touched it with a finger it would crumble and fall apart. Seeing this has to change a man.

      p Never in all their history have men been able truly to conceive of the world as one: a single sphere, a globe, having the qualities of a globe, a round earth in which all the directions eventually meet, in which there is no center because every point, or none, is center — an equal earth which all men occupy as equals. The airman's earth, if free men make it, will be truly round: a globe in practice, not in theory.

      p As I stand out here in the wonders of the unknown at Hadley, I sort of realize there’s a fundamental truth to our nature, Man must explore . . . and this is exploration at its greatest.

      p I believe every human has a finite number of heartbeats. I don't intend to waste any of mine

      p For those who have seen the Earth from space, and for the hundreds and perhaps thousands more who will, the experience most certainly changes your perspective. The things that we share in our world are far more valuable than those which divide us.

      p Here men from the planet Earth first set foot upon the Moon. July 1969 AD. We came in peace for all mankind.

      p Curious that we spend more time congratulating people who have succeeded than encouraging people who have not.
  footer Footer
              
            
!

CSS

              
                // Foundation styles for sticky footer
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}



// Other styles
@import url('https://fonts.googleapis.com/css?family=Sumana:400,700');

body {
  font-family: 'Sumana', sans-serif;
}

* {
  box-sizing: border-box;
}

header,
footer,
main {
  padding: 18px;
}

main {
  margin: 24px auto;
}

h1, p {
  margin-bottom: 24px;
}

p {
  line-height: 1.4;
}

label {
  font-weight: 700;
}

header {
  color: white;
  background-color: mediumaquamarine;
}

footer {
  color: white;
  background-color: lightseagreen;
}

.main-content {
  display: none;
}

input:checked ~ .main-content {
  display: block;
}
              
            
!

JS

              
                
              
            
!
999px

Console