Dev Helpers
← Back

Keep a subheading visible while scrolling

Keep a subheading visible while scrolling with Tailwind CSS 4 utilities. The preview uses precompiled styles.

Open this example in the interactive library

Source code

<div class="demo h-28 overflow-auto [&_.tile]:sticky [&_.tile]:top-0">
  <div class="tile">Pinned heading</div>
  <p style="height: 12rem">
    Scroll this panel to see the heading stay in place.
  </p>
</div>