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

              
                <nav>
  <h2>Revealed On Scroll</h2>
</nav>

<main>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Distinctio, repellat atque soluta sequi quae, eaque rem facere necessitatibus vel minus quia excepturi fugit ipsam totam quas eum sed accusamus ut?</p>
  <p>Eaque nobis sequi sint magnam saepe voluptatum velit quam. Sapiente aspernatur repellendus, eius adipisci, rem dolor nobis excepturi consequatur libero vitae dicta officiis sunt ratione. Nemo hic ipsum aperiam aliquam? Eaque nobis sequi sint magnam saepe voluptatum velit quam. Sapiente aspernatur repellendus, eius adipisci, rem dolor nobis excepturi consequatur libero vitae dicta officiis sunt ratione. Nemo hic ipsum aperiam aliquam? Eaque nobis sequi sint magnam saepe voluptatum velit quam. Sapiente aspernatur repellendus, eius adipisci, rem dolor nobis excepturi consequatur libero vitae dicta officiis sunt ratione. Nemo hic ipsum aperiam aliquam?</p>
  <p>Aliquam, aperiam distinctio. Facilis quia totam tempore odio natus minus assumenda iste ab error consequatur, expedita iure et magnam nisi voluptas necessitatibus ipsam, maiores eligendi blanditiis? Temporibus maiores voluptates blanditiis?</p>
  <p>Sint nisi nam aut labore sequi laboriosam voluptates earum debitis, provident minima molestias fugit quidem totam autem dolor! Molestias sequi beatae aut. Fugit et minus velit culpa quasi eos in!</p>
  <p>Nesciunt mollitia doloribus quaerat ratione aliquid quae odit ut sint eaque fugit placeat at, molestiae quo ullam, temporibus dolor. Officia ratione iusto quas dolorum enim eius porro voluptatum veritatis accusantium!</p>
</main>
              
            
!

CSS

              
                @supports (animation-timeline: view()) {
  @keyframes fade-in {
    from { opacity: 0 }
    to   { opacity: 1 }
  }
  
  @keyframes shadow-in {
    to { box-shadow: 0 10px 10px #0003 }
  }
  
  nav, nav > h2 {
    animation: fade-in auto linear both;
    animation-timeline: scroll();
    animation-range: 0% 100px;
  }
  
  nav {
    animation-name: shadow-in;
  }
}

nav {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  padding: 2rem;
}

html {
  --surface: hsl(200 10% 10%);
  --text: hsl(200 5% 80%);
  
  block-size: 100%;
  inline-size: 100%;
  
  background-color: var(--surface);
  color: var(--text);
}

body {
  min-block-size: 100%;
  min-inline-size: 100%;
  margin: 0;
  padding-block-end: 20vh;
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

main {
  max-inline-size: 50ch;
  margin-inline: auto;
}

h2 {
  margin: 0;
  text-align: center;
}

p {
  font-size: 1.25rem;
  line-height: 2;
}
              
            
!

JS

              
                
              
            
!
999px

Console