Almost embarrassed to ask, because I have never had a need to use tables much before...
Now I have a project that will require massive organized tables, go figure.
Suppose I have a table like this:
<table border="1px" style="width:300px">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</tbody>
</table>
First of all, from what I have read, <thead>
and <tbody>
seem to be optional for grouping purposes, but is this basic set up correct?
It looks fine when displayed in a browser, but I wonder if my code actually structures elements correctly in the DOM? I.E. does the DOM correctly associate the <th>First Name</th>
with the <td>
's that contain the first name data? I ask because I am going to need to rely on that to sort the tables later with javascript.
I apologize if this is really simple question. If there is a reference to a "proper table structure" article, i will accept that as well.
<tfoot>
tag can be included if you want the last column not be sort and having somethng. This is when using plugins like tablesorterstyle="border:1px solid black"
) instead. I'm unsure as to what type of association you're referring to between nodes though.thead
ortfoot
tags but may contain any number oftbody
children.