HTML Tabular Data

When it is required to display information in a tabular format on a web page, there are a number of HTML tags that can be used to do this, which are discussed below.

<table>, <tr>, <th> and <td>

These four tags, together with their corresponding closing tags, are the minimum required to display information in a tabular format with headings.

The 'table' tag is used to define a table, which can contain one or more rows, as defined by the 'tr' tag. A row can comprise of either table headings or table data. Table headings are defined using the 'th' tag, with table data using the 'td' tag. Below is an example of a table with the HTML used to produce it.

First Name Last Name Title Date of Birth
Fred Bloggs Mr 05/05/1980
Simon Smith Mr 01/04/1960
Fiona Jones Miss 19/05/1985
<table>
   <tr>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Title</th>
      <th>Date of Birth</th>
   </tr>
   <tr>
      <td>Fred</td>
      <td>Bloggs</td>
      <td>Mr</td>
      <td>05/05/1980</td>
   </tr>
   <tr>
      <td>Simon</td>
      <td>Smith</td>
      <td>Mr</td>
      <td>01/04/1960</td>
   </tr>
   <tr>
      <td>Fiona</td>
      <td>Jones</td>
      <td>Miss</td>
      <td>19/05/1985</td>
   </tr>
</table>

Further Reading

Other Tabular Data Tags