JSFiddle - React, Tailwind, and code Playground
by Cone
HTML
<br>
<br>
<table id="tabe" cellpadding=0 cellspacing=0 border=1>
<thead>
<tr>
<th>жопа</th>
<th>теперь</th>
<th>1</th>
<th>1</th>
<th>1</th>
<th>1</th>
</tr>
</thead>
<tr>
<td>Xnj nj lasda</td>
<td>Xnj nj lasda</td>
<td>Xnj nj lasda</td>
<td>Xnj nj lasda</td>
<td>Xnj nj lasda</td>
<td>Xnj nj lasda</td>
</tr>
</table>
CSS
* {
padding:0;
margin:0;
}
body {
height:800px;
}
#tabe {
border-collapse: collapse;
border-spacing: 0;
width:80%;
border:1px solid silver;
}
#heds {
top:0;
position:fixed;
width:100%;
}
thead {
visibility:hidden;
}
JavaScript
$('#tabe thead').before("<tr id='heds' style='width:" + $('#tabe').width() +"px'></tr>");
var th = $('#tabe thead').find('th');
th.each(function () {
var tex = $(this).text();
$('#heds').append("<td style='width:"+$(this).outerWidth() +"px;'>"+ tex +"</td>");
console.log($(this).width());
});