table header fixed on scroll code example
Example 1: table fixed header
.tableFixHead thead th { position: sticky; top: 0; }
Example 2: html table scrollable body fixed header
/*Simply*/ position:sticky; top: 0; /*your th elements*/
Example 3: 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; }