My table's thead
section contains 2 tr
elements with different colspans and rowspans, as shown in the image below:
https://i.sstatic.net/5aLJO.png
<table id="header-fixed">
<thead>
<tr id="tr1" role="row" style="background-color: rgb(204, 9, 47);">
<th rowspan="2" colspan="1">Unit</th>
<th rowspan="1" colspan="1">Budgeted</th>
<th rowspan="1" colspan="1">Accomplished</th>
<th rowspan="1" colspan="3">Result Attainment - Variation</th>
</tr>
<tr id="tr2" role="row" style="background-color: rgb(204, 9, 47);">
<th rowspan="1" colspan="1">Result</th>
<th rowspan="1" colspan="1">Result</th>
<th rowspan="1" colspan="1">Variation</th>
<th rowspan="1" colspan="1">%</th>
<th rowspan="1" colspan="1">Attained</th>
</tr>
</thead>
...
</table>
I am trying to make the header of this table fixed when scrolling, and I came across this code:
While this code almost works and fixes the header on scroll, the column widths are not aligned properly like in this image.
https://i.sstatic.net/A6NN6.png
Is there anyone who can assist me with this issue?