Making HTML tables scrollable with frozen header rows takes more effort than it should. I’ve written a JavaScript function that handles most common cases with a minimum of fuss.
Code and documentation are publicly available at: https://github.com/cvickery/scrollable_tables