css only - Table overflow with fixed header
Create a clone of your table. For the first table, hide all rows except the headers using visibility: hidden
. Hide the header of the other table using visibility: hidden
. Place your tables inside divs with overflow properties set as follows:
<div style="overflow-x: hidden; width: 400px;">
<div style="overflow-y: hidden; height: 20px;">
<table id="head-only">
</table>
</div>
<div style="overflow-y: scroll; height: 100px;">
<table id="body-only">
</table>
</div>
</div>