html table fixed header when scrolling code example
Example 1: table fixed header
.tableFixHead thead th { position: sticky; top: 0; }
Example 2: table fixed header
.tableFixHead { overflow: auto; height: 100px; }
.tableFixHead thead th { position: sticky; top: 0; z-index: 1; }
/* Just common table stuff. Really. */
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 16px; }
th { background:#eee; }