I need to have scrollable tbody. For that reason i putted two tables one for thead and for one tbody.
But i can't find a way to make this two tables have same width.
I know that there are a lot of solutions out there for making these with one table but none of them is working fine - because i need to have thead with bakground - color - the other solutions have width until the scroll bar on the right and that is not what i want
<table>
<thead>
<tr>
<th class="red">
Header 1
</th>
<th class="red">
Header 2
</th>
<th class="red">
Header 3
</th>
<th class="red">
Header 4
</th>
<th class="red">
Header 5
</th>
</tr>
</thead>
</table>
<table>
<tbody>
<tr>
<td class="red">Content 1</td>
<td class="red">Content 2</td>
<td class="red">Content 3</td>
<td class="red">Content 4</td>
<td class="red">Content 5</td>
</tr>
<tr>
<td class="red">Content 1</td>
<td class="red">Content 2</td>
<td class="red">Content 3</td>
<td class="red">Content 4</td>
<td class="red">Content 5</td>
</tr>
<tr>
<td class="red">Content 1</td>
<td class="red">Content 2</td>
<td class="red">Content 3</td>
<td class="red">Content 4</td>
<td class="red">Content 5</td>
</tr>
<tr>
<td class="red">Content 1</td>
<td class="red">Content 2</td>
<td class="red">Content 3</td>
<td class="red">Content 4</td>
<td class="red">Content 5</td>
</tr>
<tr>
<td class="red">Content 1</td>
<td class="red">Content 2</td>
<td class="red">Content 3</td>
<td class="red">Content 4</td>
<td class="red">Content 5</td>
</tr>
</tbody>
</table>
tbody {
display: block;
height: 50px;
overflow-y: scroll;
}
table {
border:1px solid red;
}
.red {
border:1px solid red;
}