Skip to content

Instantly share code, notes, and snippets.

@tbennett
Last active October 12, 2021 05:58
Show Gist options
  • Save tbennett/1db5fd6b64fd22867b45 to your computer and use it in GitHub Desktop.
Save tbennett/1db5fd6b64fd22867b45 to your computer and use it in GitHub Desktop.
Example of HTML Table w/ header,footer and body
<table id="example" class="display" border="1">
<!-- in HTML5 the summary, cellspacing, and cellpadding attributes are obsolete/deprecated -->
<caption> Global Employees Listing</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Position</th>
<th scope="col">Office</th>
<th scope="col">Age</th>
<th scope="col">Start date</th>
<th scope="col">Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td scope="row">T. Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>Mon 25th Apr 11</td>
<td>$320,800/y</td>
</tr>
<tr>
<td scope="row">G. Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>Mon 25th Jul 11</td>
<td>$170,750/y</td>
</tr>
<tr>
<td scope="row">A. Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>Mon 12th Jan 09</td>
<td>$86,000/y</td>
</tr>
<tr>
<td scope="row">C. Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>Thu 29th Mar 12</td>
<td>$433,060/y</td>
</tr>
<tr>
<td scope="row">A. Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>Fri 28th Nov 08</td>
<td>$162,700/y</td>
</tr>
<tr>
<td scope="row">B. Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>Sun 2nd Dec 12</td>
<td>$372,000/y</td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="6">Copyright 2015&copy;</th>
</tr>
</tfoot>
</table>
@tbennett
Copy link
Author

Current best practice is to have the tfoot after the tbody. Previously, the thead AND tfoot were supposed to precede the tbody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment