JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css">
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.css">
<table id="complexHeader" class="display" style="width: 100%;">
<thead>
<tr>
<th rowspan="2">amet</th>
<th rowspan="2">dolor</th>
<th rowspan="2">sit</th>
<th rowspan="2">Lorem</th>
<th rowspan="2">Aliquam</th>
<th colspan="4" class="text-center">mollis</th>
<th colspan="4" class="text-center">Nulla</th>
</tr>
<tr>
<th>quis</th>
<th>vestibulum</th>
<th>hendrerit</th>
<th>facilisi</th>
<th>eget</th>
<th>lobortis</th>
<th>gravida</th>
<th>metus</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>$320,800</td>
<td>Edinburgh</td>
<td>5421</td>
<td>[email protected]</td>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>$170,750</td>
<td>Tokyo</td>
<td>8422</td>
<td>[email protected]</td>
<td>Ashton Cox</td>
</tr>
<tr>
<td>Junior Technical Author</td>
<td>$86,000</td>
<td>San Francisco</td>
<td>1562</td>
<td>[email protected]</td>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>$433,060</td>
<td>Edinburgh</td>
<td>6224</td>
<td>[email protected]</td>
<td>Airi Satou</td>
<td>Accountant</td>
</tr>
<tr>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>$137,500</td>
<td>San Francisco</td>
<td>$162,700</td>
<td>Tokyo</td>
<td>5407</td>
...
JavaScript
$(document).ready(function() {
complexHeaderTable();
});
function complexHeaderTable() {
var complexHeader = $("#complexHeader")
.addClass("nowrap")
.DataTable({
responsive: true,
});
}