css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              <h1>
  <pre>position: <span>sticky</span>;</pre>
</h1>
<main>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Amet cursus sit amet dictum sit amet. Eget est lorem ipsum dolor. Viverra ipsum nunc aliquet bibendum enim. Ullamcorper malesuada proin libero nunc consequat interdum varius sit amet. Diam donec adipiscing tristique risus nec feugiat in. Et netus et malesuada fames. Quisque id diam vel quam elementum pulvinar etiam. Cursus turpis massa tincidunt dui ut ornare lectus. Quam elementum pulvinar etiam non quam lacus suspendisse faucibus interdum. Sed cras ornare arcu dui vivamus arcu.</p>

  <div class="sticky">
    <p>🦑</p>
  </div>
  
  <p>Sagittis purus sit amet volutpat. Senectus et netus et malesuada fames. Commodo elit at imperdiet dui accumsan sit amet nulla. Morbi tristique senectus et netus et. Posuere ac ut consequat semper viverra nam libero justo. Lectus proin nibh nisl condimentum id. Sed vulputate mi sit amet mauris commodo quis. Turpis in eu mi bibendum neque. Eget dolor morbi non arcu risus quis varius quam quisque. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Ultricies mi quis hendrerit dolor. Nunc sed id semper risus in hendrerit gravida rutrum quisque. Turpis egestas sed tempus urna et pharetra pharetra massa.</p>

  <p>Tortor pretium viverra suspendisse potenti nullam ac tortor. Curabitur vitae nunc sed velit dignissim. Scelerisque eleifend donec pretium vulputate sapien nec sagittis aliquam. Condimentum lacinia quis vel eros donec ac odio tempor. Auctor augue mauris augue neque gravida in fermentum. Nec feugiat in fermentum posuere urna. Malesuada fames ac turpis egestas maecenas. Vestibulum lectus mauris ultrices eros in cursus. In hendrerit gravida rutrum quisque non tellus orci ac auctor. Id aliquet risus feugiat in ante metus. Dolor magna eget est lorem ipsum dolor sit amet. Lacus luctus accumsan tortor posuere ac ut consequat semper.</p>

  <p>Non diam phasellus vestibulum lorem sed risus ultricies tristique nulla. Ullamcorper velit sed ullamcorper morbi tincidunt. Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Justo eget magna fermentum iaculis eu non diam. In fermentum et sollicitudin ac orci phasellus egestas tellus rutrum. Nunc non blandit massa enim nec. Diam maecenas ultricies mi eget mauris pharetra. Proin nibh nisl condimentum id venenatis a. Dui faucibus in ornare quam viverra orci sagittis. Eu mi bibendum neque egestas congue quisque egestas diam in. Elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Nunc consequat interdum varius sit amet. Placerat duis ultricies lacus sed turpis tincidunt id aliquet. Mattis nunc sed blandit libero.</p>

  <p>Aliquam ut porttitor leo a diam sollicitudin tempor id eu. Id interdum velit laoreet id donec. Et malesuada fames ac turpis egestas sed tempus. In mollis nunc sed id. Mauris vitae ultricies leo integer malesuada nunc vel. Egestas fringilla phasellus faucibus scelerisque eleifend. Suspendisse potenti nullam ac tortor vitae purus faucibus. Fermentum odio eu feugiat pretium nibh ipsum consequat. Ipsum dolor sit amet consectetur adipiscing. Pretium vulputate sapien nec sagittis. Tortor vitae purus faucibus ornare suspendisse.</p>
</main>
<div class="links">
  <a class="link-ciu" target="_blank" href="https://caniuse.com/#feat=css-sticky">Can i use</a>
  -
  <a target="_blank" href="https://developer.mozilla.org/fr/docs/Web/CSS/position">MDN</a>
</div>
            
          
!
            
              * {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: linear-gradient(-20deg, #7028e4 0%, #e5b2ca 100%);
}

main {
  position: relative;
  max-width: 480px;
  max-height: 480px;
  padding: 20px 10px 20px 20px;
  overflow-y: scroll;
  background: #fff;
  
  .sticky {
    position: sticky;
    top: 0;
    font-size: 3rem;
  }
  
  p {
    margin: 0 0 1rem;
  }
  
}

h1 {
  color: #fff;
  margin: 0;
  
  pre {
    
    span {
      background-color: rgba(#000,.15);
      padding: 0.3rem;
      border-radius: 6px;
    }
  }
}

.links {
  color: #fff;
  margin: 1rem auto;
  
  a {
    display: inline-block;
    color: #fff;
    font-size: 0.8rem;
  }
}

            
          
!
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.
Loading ..................

Console