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

              
                <div class="content">
  <div class="spacer"></div>
  <div id="page">
    <section>
      First Stuff<br>
      First Stuff<br> First Stuff<br> First Stuff<br> First Stuff<br> First Stuff<br>First Stuff<br>Why can't I scroll to the bottom?
    </section>
    <section>
      <div id="container">
        <div id="thing">Pinned block (inside of pinned content)</div>
      </div>
    </section>
    <section>
      More Stuff<br> More Stuff<br> More Stuff<br> More Stuff<br> More Stuff<br> More Stuff<br>More Stuff
    </section>
    <section>
      More Stuff<br> More Stuff<br> More Stuff<br> More Stuff<br> More Stuff<br> More Stuff<br>More Stuff<br>
      Why can't I scroll to the bottom?
    </section>
    <div id="footer">Footer</div>
  </div>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Signika+Negative:300,400&display=swap");

body {
  font-family: "Signika Negative", sans-serif;
  font-weight: 300;
  margin: 0;
  padding: 0 20px;
  color: red;
}

nav {
  position: fixed;
  background: #fcf6;
  height: 30px;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
}

#container {
  margin: auto;
  max-width: 80vw;
  padding: 0 30px;
}
section {
  text-align: center;
  border: 1px solid red;
  padding: 80px 0;
}

#top {
  background: #cfc;
  height: 100vh;
  padding: 0;
}

#thing {
  background: yellow;
  height: 400px;
}

#footer {
  text-align: center;
  height: 60px;
  background: #ffc;
}

.spacer {
  height: 100vh;
  border: 1px solid red;
}
              
            
!

JS

              
                ScrollSmoother.create({
  content: "#content",
  normalizeScroll: false,
  smooth: 1, // how long (in seconds) it takes to "catch up" to the native scroll position
  effects: false, // looks for data-speed and data-lag attributes on elements
  smoothTouch: false // much shorter smoothing time on touch devices (default is NO smoothing on touch devices)
});

ScrollTrigger.create({
  trigger: "#page",
  start: "top top",
  end: () => `+=${window.innerHeight}`,
  invalidateOnRefresh: true,
  pin: true,
  pinSpacing: true
});

ScrollTrigger.create({
  trigger: "#container",
  start: "center center",
  end: () => `+=${window.innerHeight}`,
  invalidateOnRefresh: true,
  pin: true,
  pinType: 'transform',
  pinnedContainer: "#page",
});


              
            
!
999px

Console