123

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <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>
            
          
!
            
              body {
  position:relative;
}
            
          
!
            
              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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console