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

              
                <header>
  Here is the Header
</header>
<div class="content">
  <p>Here is some short content.</p>
  <!--
  Add/Remove the following HTML to see how the page reacts with page content that is taller and shorter than the viewport.
  -->
  <!--
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt magna et libero interdum vehicula. Phasellus imperdiet neque sit amet placerat pulvinar. Proin eu ultricies ligula, a luctus velit. Integer posuere magna quis tortor maximus, ut ultricies velit fermentum. Cras malesuada suscipit sapien, at tempor ante placerat non. Nam sem erat, congue ac dui viverra, elementum lacinia risus. Nam gravida elit et finibus iaculis. Maecenas imperdiet dolor at faucibus sodales. Cras orci nunc, blandit nec accumsan quis, consequat eu arcu. Vivamus id velit condimentum erat luctus ultrices vel et erat.</p>

<p>Quisque mauris lectus, convallis vel aliquam at, vulputate sed nunc. Etiam eget neque varius, dapibus magna a, semper turpis. Curabitur eget ante eget neque lobortis egestas nec nec leo. Proin efficitur ipsum et orci mollis, at tincidunt tortor convallis. Duis vitae massa ut urna pretium aliquam quis non mauris. Sed venenatis vestibulum feugiat. Donec ut ipsum accumsan, pulvinar tellus quis, vulputate enim. Duis auctor imperdiet dui, cursus luctus enim dictum quis. Mauris viverra placerat ex sit amet venenatis. Nam egestas dolor mi, non tempus neque hendrerit eget. In eleifend lectus vitae metus varius, eu dictum mauris facilisis.</p>

<p>Proin aliquam malesuada libero nec rhoncus. Sed ut orci convallis, ornare ante sed, scelerisque magna. Mauris dignissim egestas ligula, vitae malesuada felis egestas sed. Mauris volutpat et risus congue iaculis. Curabitur luctus vehicula urna blandit varius. Nam tristique aliquam odio, nec facilisis metus iaculis in. Mauris eu pretium mauris. Cras pharetra feugiat porttitor. Ut convallis et tortor sed commodo. Duis tincidunt eleifend ex ac porta. Mauris sagittis lorem enim, non facilisis nulla aliquam non. Maecenas tempus nisl euismod eros sagittis imperdiet. Quisque non erat finibus, congue turpis ut, bibendum lectus. Curabitur in nisi interdum, consectetur metus ultrices, interdum lorem. Nullam lectus nibh, vulputate eu sem nec, maximus viverra tortor.</p> 
  -->
</div>
<footer>
  Here is the Footer
</footer>
              
            
!

CSS

              
                body {
  position:relative;
}
              
            
!

JS

              
                var init_footer_placement = function(){
	console.log('init_footer_placement called');
  if ($('body > footer').length) {
		// if the footer element is present on this page...
		var viewport_height, footer_height, footer_offset, footer_bottom;
		
		$('body > footer').css('position', 'static');
    // reset footer to static position to get natural	values	
		
		viewport_height   = $(window).height();
		footer_height     = $('body > footer').outerHeight();
		footer_offset     = $('body > footer').offset();
		footer_bottom     = footer_offset.top + footer_height;		
		console.log('viewport height: ' + viewport_height);
    console.log('footer bottom: ' + footer_bottom);
		if (viewport_height > footer_bottom) {
			$('body > footer').css('position', 'absolute');
			$('body > footer').css('bottom', '-' + (viewport_height - footer_bottom) + 'px');
		}
	}
};    

jQuery( document ).ready(function() {
  $(window).on('resize', function(){
  	// call init_footer_placement everytime the viewport is resized
  	init_footer_placement();
  });
  
  // initial call to init_footer_placement function
  init_footer_placement();
});
              
            
!
999px

Console