I'm trying to display a table
which displays some grouped data.
The header should stick (at the top of the viewport), and also some table rows that contain the group titles.
For simplicity, I've created the following example on Codepen: https://codepen.io/andreivictor/pen/RwZRZav
The code I've tried is:
td.sticky {
background: red;
color: white;
position: sticky;
top: 50px; // this is the header height
}
Which works well on Chrome & Firefox.
The problem is that it doesn't work in Safari (tested on Safari v14); neither in Safari mobile. See the screenshot:
https://i.stack.imgur.com/08o4L.png - the row is sticky - but the top
position is different (relative to the top of the table - and not to top of the viewport).