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

              
                <main>
  <div class="container">
      <p>
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Ad illo error consequuntur distinctio temporibus sunt consectetur reiciendis impedit, libero, rerum atque sit harum dicta tempore, doloremque perferendis assumenda provident. Quo commodi nesciunt earum officia maxime voluptas rerum tempore magnam dolorem?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam dicta blanditiis voluptatum explicabo quis beatae quas ut enim ducimus debitis, fugit neque necessitatibus quam quaerat autem officiis commodi molestias exercitationem odio qui amet, culpa impedit dolorem alias. Modi, inventore cumque.
    </p>
    <p>
      Lorem ipsum, dolor sit amet consectetur adipisicing elit. Beatae quo assumenda recusandae illo excepturi? Delectus praesentium cum inventore velit voluptas, optio debitis iure aspernatur quam expedita nulla consectetur illo esse possimus sapiente ducimus alias laudantium. Possimus pariatur consequatur nam dolore sint quas, placeat libero nesciunt debitis, expedita nisi, magni tempora?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa, nemo? Ipsum laboriosam sunt veritatis ratione natus debitis neque animi, illo, recusandae cum dolor facere facilis nobis expedita dolorem et deserunt hic iusto possimus ducimus laudantium impedit odio sint. Enim similique natus fugiat, omnis nihil expedita temporibus quo quos repudiandae, consequatur earum debitis. Temporibus, aliquid voluptas repudiandae voluptatem odit tempore recusandae.
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Ad illo error consequuntur distinctio temporibus sunt consectetur reiciendis impedit, libero, rerum atque sit harum dicta tempore, doloremque perferendis assumenda provident. Quo commodi nesciunt earum officia maxime voluptas rerum tempore magnam dolorem?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam dicta blanditiis voluptatum explicabo quis beatae quas ut enim ducimus debitis, fugit neque necessitatibus quam quaerat autem officiis commodi molestias exercitationem odio qui amet, culpa impedit dolorem alias. Modi, inventore cumque.
    </p>
    <p>
      Lorem ipsum, dolor sit amet consectetur adipisicing elit. Beatae quo assumenda recusandae illo excepturi? Delectus praesentium cum inventore velit voluptas, optio debitis iure aspernatur quam expedita nulla consectetur illo esse possimus sapiente ducimus alias laudantium. Possimus pariatur consequatur nam dolore sint quas, placeat libero nesciunt debitis, expedita nisi, magni tempora?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa, nemo? Ipsum laboriosam sunt veritatis ratione natus debitis neque animi, illo, recusandae cum dolor facere facilis nobis expedita dolorem et deserunt hic iusto possimus ducimus laudantium impedit odio sint. Enim similique natus fugiat, omnis nihil expedita temporibus quo quos repudiandae, consequatur earum debitis. Temporibus, aliquid voluptas repudiandae voluptatem odit tempore recusandae.
    </p>
    <p>
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Ad illo error consequuntur distinctio temporibus sunt consectetur reiciendis impedit, libero, rerum atque sit harum dicta tempore, doloremque perferendis assumenda provident. Quo commodi nesciunt earum officia maxime voluptas rerum tempore magnam dolorem?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam dicta blanditiis voluptatum explicabo quis beatae quas ut enim ducimus debitis, fugit neque necessitatibus quam quaerat autem officiis commodi molestias exercitationem odio qui amet, culpa impedit dolorem alias. Modi, inventore cumque.
    </p>
    <p>
      Lorem ipsum, dolor sit amet consectetur adipisicing elit. Beatae quo assumenda recusandae illo excepturi? Delectus praesentium cum inventore velit voluptas, optio debitis iure aspernatur quam expedita nulla consectetur illo esse possimus sapiente ducimus alias laudantium. Possimus pariatur consequatur nam dolore sint quas, placeat libero nesciunt debitis, expedita nisi, magni tempora?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa, nemo? Ipsum laboriosam sunt veritatis ratione natus debitis neque animi, illo, recusandae cum dolor facere facilis nobis expedita dolorem et deserunt hic iusto possimus ducimus laudantium impedit odio sint. Enim similique natus fugiat, omnis nihil expedita temporibus quo quos repudiandae, consequatur earum debitis. Temporibus, aliquid voluptas repudiandae voluptatem odit tempore recusandae.
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Ad illo error consequuntur distinctio temporibus sunt consectetur reiciendis impedit, libero, rerum atque sit harum dicta tempore, doloremque perferendis assumenda provident. Quo commodi nesciunt earum officia maxime voluptas rerum tempore magnam dolorem?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam dicta blanditiis voluptatum explicabo quis beatae quas ut enim ducimus debitis, fugit neque necessitatibus quam quaerat autem officiis commodi molestias exercitationem odio qui amet, culpa impedit dolorem alias. Modi, inventore cumque.
    </p>
    <p>
      Lorem ipsum, dolor sit amet consectetur adipisicing elit. Beatae quo assumenda recusandae illo excepturi? Delectus praesentium cum inventore velit voluptas, optio debitis iure aspernatur quam expedita nulla consectetur illo esse possimus sapiente ducimus alias laudantium. Possimus pariatur consequatur nam dolore sint quas, placeat libero nesciunt debitis, expedita nisi, magni tempora?
    </p>
    <p>
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Ad illo error consequuntur distinctio temporibus sunt consectetur reiciendis impedit, libero, rerum atque sit harum dicta tempore, doloremque perferendis assumenda provident. Quo commodi nesciunt earum officia maxime voluptas rerum tempore magnam dolorem?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam dicta blanditiis voluptatum explicabo quis beatae quas ut enim ducimus debitis, fugit neque necessitatibus quam quaerat autem officiis commodi molestias exercitationem odio qui amet, culpa impedit dolorem alias. Modi, inventore cumque.
    </p>
    <p>
      Lorem ipsum, dolor sit amet consectetur adipisicing elit. Beatae quo assumenda recusandae illo excepturi? Delectus praesentium cum inventore velit voluptas, optio debitis iure aspernatur quam expedita nulla consectetur illo esse possimus sapiente ducimus alias laudantium. Possimus pariatur consequatur nam dolore sint quas, placeat libero nesciunt debitis, expedita nisi, magni tempora?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa, nemo? Ipsum laboriosam sunt veritatis ratione natus debitis neque animi, illo, recusandae cum dolor facere facilis nobis expedita dolorem et deserunt hic iusto possimus ducimus laudantium impedit odio sint. Enim similique natus fugiat, omnis nihil expedita temporibus quo quos repudiandae, consequatur earum debitis. Temporibus, aliquid voluptas repudiandae voluptatem odit tempore recusandae.
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Ad illo error consequuntur distinctio temporibus sunt consectetur reiciendis impedit, libero, rerum atque sit harum dicta tempore, doloremque perferendis assumenda provident. Quo commodi nesciunt earum officia maxime voluptas rerum tempore magnam dolorem?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam dicta blanditiis voluptatum explicabo quis beatae quas ut enim ducimus debitis, fugit neque necessitatibus quam quaerat autem officiis commodi molestias exercitationem odio qui amet, culpa impedit dolorem alias. Modi, inventore cumque.
    </p>
    <p>
      Lorem ipsum, dolor sit amet consectetur adipisicing elit. Beatae quo assumenda recusandae illo excepturi? Delectus praesentium cum inventore velit voluptas, optio debitis iure aspernatur quam expedita nulla consectetur illo esse possimus sapiente ducimus alias laudantium. Possimus pariatur consequatur nam dolore sint quas, placeat libero nesciunt debitis, expedita nisi, magni tempora?
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa, nemo? Ipsum laboriosam sunt veritatis ratione natus debitis neque animi, illo, recusandae cum dolor facere facilis nobis expedita dolorem et deserunt hic iusto possimus ducimus laudantium impedit odio sint. Enim similique natus fugiat, omnis nihil expedita temporibus quo quos repudiandae, consequatur earum debitis. Temporibus, aliquid voluptas repudiandae voluptatem odit tempore recusandae.
    </p>
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa, nemo? Ipsum laboriosam sunt veritatis ratione natus debitis neque animi, illo, recusandae cum dolor facere facilis nobis expedita dolorem et deserunt hic iusto possimus ducimus laudantium impedit odio sint. Enim similique natus fugiat, omnis nihil expedita temporibus quo quos repudiandae, consequatur earum debitis. Temporibus, aliquid voluptas repudiandae voluptatem odit tempore recusandae.
    </p>
  </div>
  <a href="#" class="js-back-to-top back-to-top">Back to Top</a>
</main>
<footer class="js-site-footer site-footer">
  <div class="container">
    <ul class="site-footer__contact nav nav--inline">
      <li><a href="#">888.888.8888</a></li>
      <li><a href="#">contact@test.com</a></li>
    </ul>
    <ul class="site-footer__nav nav nav--inline">
      <li class="site-footer__nav-item">
        <a href="#" class="site-footer__nav-link">Contact Us</a>
      </li>
      <li class="site-footer__nav-item">
        <a href="#" class="site-footer__nav-link">News &amp; Resources</a>
      </li>
      <li class="site-footer__nav-item">
        <a href="#" class="site-footer__nav-link">Locations</a>
      </li>
      <li class="site-footer__nav-item">
        <a href="#" class="site-footer__nav-link">Partners</a>
      </li>
      <li class="site-footer__nav-item">
        <a href="#" class="site-footer__nav-link">Terms of Use</a>
      </li>
      <li class="site-footer__nav-item">
        <a href="#" class="site-footer__nav-link">Privacy Policy</a>
      </li>
    </ul>
    <div class="footer__legal">
      Copyright © 2017 The Aero Corporation. All Rights Reserved.
    </div>
  </div>
</footer>
              
            
!

CSS

              
                /* ==========================================================================
   $Table of Contents
   ========================================================================== */
/**
 * Variables
 * Mixins
 * Functions
 * Globals
 * Grid
 */

// ==========================================================================
// $Variables
// ==========================================================================
$breakpoints: (
  sm: 400px,
  md: 650px,
  lg: 900px
);

// Grid System
$grid-columns:              12 !default;
//** Padding between columns. Gets divided in half for the left and right.
$grid-gutter-width:         30px !default;

$z-layers: (
  under: -1,
  default: 1,
  overlay: 900
);

// ==========================================================================
// $Mixins
// ==========================================================================
@mixin mq($breakpoint) {
  // Goes to $breakpoints map and gets each $breakpoint value (if it has any)
  @if map-has-key($breakpoints, $breakpoint) {

    // Create media query based on that $breakpoint value
    @media (min-width: #{map-get($breakpoints, $breakpoint)}) {
      @content;
    }

  }
  @else {
    @warn "Breakpoint doesn't exist please check breakpoints map.";
  }
}

// Framework grid generation
//
//
// Used only by Bootstrap to generate the correct number of grid classes given
// any value of `$grid-columns`.
@mixin make-grid-columns($i: 1, $list: ".col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}") {
  @for $i from (1 + 1) through $grid-columns {
    $list: "#{$list}, .col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}";
  }
  #{$list} {
    position: relative;
    // Prevent columns from collapsing when empty
    min-height: 1px;
    // Inner gutter via padding
    padding-left:  ceil(($grid-gutter-width / 2));
    padding-right: floor(($grid-gutter-width / 2));
  }
}

@mixin float-grid-columns($class, $i: 1, $list: ".col-#{$class}-#{$i}") {
  @for $i from (1 + 1) through $grid-columns {
    $list: "#{$list}, .col-#{$class}-#{$i}";
  }
  #{$list} {
    float: left;
  }
}

@mixin calc-grid-column($index, $class, $type) {
  @if ($type == width) and ($index > 0) {
    .col-#{$class}-#{$index} {
      width: percentage(($index / $grid-columns));
    }
  }
  @if ($type == push) and ($index > 0) {
    .col-#{$class}-push-#{$index} {
      left: percentage(($index / $grid-columns));
    }
  }
  @if ($type == push) and ($index == 0) {
    .col-#{$class}-push-0 {
      left: auto;
    }
  }
  @if ($type == pull) and ($index > 0) {
    .col-#{$class}-pull-#{$index} {
      right: percentage(($index / $grid-columns));
    }
  }
  @if ($type == pull) and ($index == 0) {
    .col-#{$class}-pull-0 {
      right: auto;
    }
  }
  @if ($type == offset) {
    .col-#{$class}-offset-#{$index} {
      margin-left: percentage(($index / $grid-columns));
    }
  }
}

@mixin loop-grid-columns($columns, $class, $type) {
  @for $i from 0 through $columns {
    @include calc-grid-column($i, $class, $type);
  }
}

// Create grid for specific class
@mixin make-grid($class) {
  @include float-grid-columns($class);
  @include loop-grid-columns($grid-columns, $class, width);
  @include loop-grid-columns($grid-columns, $class, pull);
  @include loop-grid-columns($grid-columns, $class, push);
  @include loop-grid-columns($grid-columns, $class, offset);
}

// Active states
@mixin is-active {

  &:hover,
  &:focus,
  &:active,
  &.active { @content; }  

}

// Accessible Text
@mixin hide-text {
  color: transparent;
  font: 0/0 serif;
}

// ==========================================================================
// $Functions
// ==========================================================================
@function z($layer) {
  @if not map-has-key($z-layers, $layer) {
    @warn "No layer found for `#{$layer}` in $z-layers map.";
  }

  @return map-get($z-layers, $layer);
}


/* ==========================================================================
   $Globals
   ========================================================================== */
*,
*:before,
*:after {
  box-sizing: border-box;
}

html {
  box-sizing: inherit;
  font-family: 'Open Sans Condensed', sans-serif;
  font-size: 1.5rem;
  line-height: 1.3;
}

.container {
  max-width: 85%;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}

/* ==========================================================================
   $Grid
   ========================================================================== */
@include make-grid-columns;
@include make-grid(xs);

@include mq(sm) {
  @include make-grid(sm);
}

@include mq(md) {
  @include make-grid(md);
}

@include mq(lg) {
  @include make-grid(lg);
}

main {
  position: relative;
}

.nav {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.nav a {
  color: inherit;
  text-decoration: none;
}

.nav--inline {
  
  @include mq(lg) {
    display: flex;
    flex-flow: row nowrap;
  }
}

.nav--inline > li {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

//
// Back to Top
//
.back-to-top {
  background-color: rgba(46, 0, 139, .6);
  border-top-left-radius: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font: 0/0 serif;
  font-weight: 700;
  height: 60px;
  width: 60px;
  text-decoration: none;
  padding: 1rem;
  right: 0;
  bottom: 0vh;
  
  &:before {
    color: #fff;
    content: '⬆';
    font-size: 1rem;
    position: relative;
    bottom: -0.25rem;
  }
}

.back-to-top.is-stuck {
  animation: pop-up 0.3s ease-in-out forwards;
  position: absolute;
}

.back-to-top.is-sticky {
  position: fixed;
}

//
// Footer
//
.site-footer {
  background-color: rgba(46, 0, 139, .97);
  color: #fff;
  font-weight: 700;
  font-size: 70%;
  padding-top: 1.2rem;
  padding-bottom: 1rem;
}

.site-footer__contact {
  
  @include mq(md) {
    float: left;
  }
}

.site-footer__nav {
  
  @include mq(md) {
    float: right;
  }
}

.footer__legal {
  color: rgba(255, 255, 255, 0.7);
  font-size: 80%;
  letter-spacing: 1px;
  margin-top: 1.5rem;
  text-align: center;
  
  @include mq(md) {
    float: left;
    width: 100%;
  }
}

@keyframes pop-up {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
              
            
!

JS

              
                $(function(){
  var $footer = $('.site-footer');
  var $backToTop = $('.js-back-to-top');
    
  var stickyFooter = debounce(function(){
    
    // $footer.isInViewport() ? $backToTop.css('position', 'absolute') : $backToTop.css('position', 'fixed');
  $footer.isInViewport() ? $backToTop.addClass('is-stuck').removeClass('is-sticky') : $backToTop.addClass('is-sticky').removeClass('is-stuck');
    
  }, 100);
  
  $(window).on('scroll', stickyFooter);
  
});

function debounce(func, wait, immediate) {
	var timeout;
	return function() {
		var context = this, args = arguments;
		var later = function() {
			timeout = null;
			if (!immediate) func.apply(context, args);
		};
		var callNow = immediate && !timeout;
		clearTimeout(timeout);
		timeout = setTimeout(later, wait);
		if (callNow) func.apply(context, args);
	};
};

$.fn.isInViewport = function() {
  var elementTop = $(this).offset().top;
  var elementBottom = elementTop + $(this).outerHeight();

  var viewportTop = $(window).scrollTop();
  var viewportBottom = viewportTop + $(window).height();

  return elementBottom > viewportTop && elementTop < viewportBottom;
};
              
            
!
999px

Console