How to make a sticky element

Thanks @vincent that is great. It’s not great on mobile though, but nice for web.

Thanks for your fast response.

I am now looking into persistant headers Persistent Headers | CSS-Tricks - CSS-Tricks

Is this the same as putting an element on fixed with a high z-index or something different.

What you’re reffering to are sticky elements. Your example is a bit more complex because the sticky elements vanishes when its context (the table) goes out of screen. Usually you’ll find this behavior for navigation bars.

It’s more complex.

Even if there’s a way with only CSS it requires a “sticky” property of webkit that is too new to be supported by all browsers.

http://vincent.polenordstudio.fr/snap/8najj.jpg

So it requires Javascript, here is a simple approach: