Black Lives Matter! ✊🏾

position: sticky

A stickily positioned box is positioned similarly to a relatively positioned box, but the offset is computed with reference to the nearest ancestor with a scrolling box, or the viewport if no ancestor has a scrolling box. 6.2. Sticky positioning

Links about position: sticky

  1. Fixed Table Headers

    posted on by Adrian Roselli

    Related A Responsive Accessible Table Hey, It’s Still OK to Use Tables Keyboard and Overflow

  2. Position Sticky and Table Headers | CSS-Tricks

    posted on by Chris Coyier

    You can’t position: sticky; a . Nor a . But you can sticky a , which means you can make sticky headers inside a regular ol’ . This is tricky stuff,

Code sample

header {
position: sticky;
}