Table with fixed header, footer and left column using position:sticky Example

Table with fixed header, footer and left column using position:sticky

Back to Tutorial

Table with fluid height and width fixed header, footer and first column using position:sticky

This example uses position:sticky on the th elements in the thead, tfoot and left column to achieve the fixed effect. Browsers that don't support position:sticky will just get a normal table so no harm done. Resize browser smaller to see fixed first column.

Header 1 Header 2 Header 3 with longer content Header 4 text Header 5 Header 6 Header 7 Header 8
First top Column Cell content
test
Cell content longer Cell content with more content and more content Cell Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Left Column
last
Cell content Cell content longer Cell content Cell content Cell content Cell content Cell content
Footer 1 Footer 2 Footer 3 Footer 4 Footer 5 Footer 6 Footer 7 Footer 8

Works in latest versions of modern browsers i.e. Edge, Chrome, Safari/ios and Firefox. Does not work in IE11 or older browsers but no harm done.

All of the other fixed table headers and footers that I've seen are either fixed width or fixed height or need a continuous update with JS and are very janky. This one is very smooth. You would of course need to linearise the data for smaller screens/mobile but that is a question for another day :). See this example for a demo of how to linearise for mobile.