JSFiddle - React, Tailwind, and code Playground
by ionmang20
HTML
<div class="outerDIV">
<div class="innerDIV">
<table border="1">
<thead>
<tr>
<th>Column1</th>
<th>Column2</th>
<th>Column3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Line1Cell1</td>
<td>Line1Cell2</td>
<td>Line1Cell3</td>
</tr>
<tr>
<td>Line2Cell1</td>
<td>Line2Cell2</td>
<td>Line2Cell3</td>
</tr>
<tr>
<td>Line3Cell1</td>
<td>Line3Cell2</td>
<td>Line3Cell3</td>
</tr>
</tbody>
</table>
</div>
</div>
CSS
.outerDIV {
position: relative;
padding-top: 30px;
display:inline-block;
}
.innerDIV {
overflow: auto;
max-height: 40px;
padding-right:1.1em;
margin-right:-1.1em;
}
table thead {
display:table;
width:100%;
border:solid 1px gray;
box-sizing:border-box;
position: absolute;
border-bottom:0;
top: 0;
left: 0;
right:0;
}