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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <h1>This is a sticky page!</h1>
<div class="page page-bg-blue sticky-page">
  <h1>page one</h1>

<div class="page page-bg-red sticky-page">
  <h1>page two</h1>

<div class="page page-bg-green sticky-page">
  <h1>page three</h1>


                * {
  box-sizing: border-box;  

html, body {
  min-height: 100%;
  margin: 0;
  overflow: auto;
  font-family: sans-serif;
  position: relative;

h1 {
  text-align: center;
  margin: 5em 0;

.page {
  width: 100%;
  height: 1000px;
  margin: 0;
  border: 20px solid white;
  padding: 1em;
  background: #ccc;
  text-align: center;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.2);

.page h1 {
  text-transform: uppercase;
  color: white;
  display: inline-block;
  position: relative;
  margin: 1em 0 0;

.page h1:after {
  content: '';
  width: 100%;
  position: absolute;
  top: 120%;
  opacity: 0.5;
  border-bottom: 2px solid #fff;
  display: block;
} {
  position: fixed !important;
  top: 0 !important;
  left: 0;
  right: 0;

.page-bg-green {
  background: #42d472;

.page-bg-blue {
  background: #42c4d4;

.page-bg-red {
  background: #d44242;


  // get viewport width / height
  var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight,
      pages = $('.sticky-page'),
      pagesCache = {};
  // prevent body from collapsing when pages are pinned by explicitly setting height after page has loaded but before we reposition the pages
  $('body').css({'height' : $('body').height() })
  // reverse loop so offsets aren't affected by repositioned pages
  for (var i = pages.length; i--; ) {
    var _this = pages.eq(i),
        top = _this.offset().top
    // layer z-index properly
      'z-index' : 1000*i+100,
      'height' : y + 'px',
      'top' : top + 'px',
      'position' : 'absolute'
    // cache it
    pagesCache[i] = { "node": _this, "offset": top }
  $(w).scroll(function() {
    // what the y position of the scroll is
    var scrollPos = e.scrollTop
    // compare to cached objects
    for (obj in pagesCache) {
      if (scrollPos >= pagesCache[obj].offset) {
      } else {