I'm attempting to organize tables in a nested manner, instead of placing a table within each cell. My engineers have advised against simply styling the table to appear nested, and suggested that it would be more effective to wrap each header around the child rows and cells.
Shown below is an example of how the layout should look:
This is my HTML code:
<section class="container">
<table class="zebra">
<thead>
<tr>
<th>Code</th>
<th>Procedure</th>
<th>Units</th>
<th>Charge</th>
<th>Avg. Charge</th>
<th>As %</th>
</tr>
</thead>
<tbody class="level1">
<tr>
<td colspan="6">
<i class="doctor"></i>John Dorian
</td>
</tr>
<tbody class="level2">
<tr>
<td colspan="6">
<i class="address"></i>Southern Hills Hospital
</td>
</tr>
<tbody class="level3">
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
</tbody>
</tbody>
</tbody>
<tbody class="level1">
<tr>
<td colspan="6">
<i class="doctor"></i>John Dorian
</td>
</tr>
<tbody class="level2">
<tr>
<td colspan="6">
<i class="address"></i>Southern Hills Hospital
</td>
</tr>
<tbody class="level3">
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
</tbody>
</tbody>
<tbody class="level2">
<tr>
<td colspan="6">
<i class="address"></i>Southern Hills Hospital
</td>
</tr>
<tbody class="level3">
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
</tbody>
</tbody>
<tbody class="level2">
<tr>
<td colspan="6">
<i class="address"></i>Southern Hills Hospital
</td>
</tr>
<tbody class="level3">
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
<tr>
<td>99234</td>
<td>Chest XRay</td>
<td>1</td>
<td>20.00</td>
<td>40.00</td>
<td>10.00</td>
</tr>
</tbody>
</tbody>
</tbody>
</table>
As shown, I am nesting tbody
elements within other tbody
elements. This displays correctly in Chrome, but when inspecting elements in Chrome, Safari, and Firefox, they treat the nested tbody
elements differently. See example here:
Any suggestions on achieving the desired outcome?