I have a table with dynamically generated data. Because of space limitation, I need to be able to make the the tbody scrollable.
My table looks like this:
<table>
<thead> <! -- This thead needs to stay in a fixed position-->
<tr>
<th></th>
<th></th>
</tr>
<thead>
<tbody> <! -- This tbody needs to stay in a fixed position-->
<tr>
<td></td>
<td></td>
</tr>
</tbody>
<tbody> <! -- This tbody needs to scroll -->
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
I've tried using css, but have been unsuccessful:
table tbody:nth-child(2) {
height:500px;
max-height:500px;
overflow-y: scroll;
}
My ideal solution is simple css. Any suggestions? Also, why does setting a height on a tbody not work?