HTML Tables

HTML tables are used to organise information into rows and columns.

At Advanced Higher, you need to know the following table elements:

  • <table> — creates the table
  • <tr> — creates a table row
  • <th> — creates a table heading
  • <td> — creates a table data cell

Example

HTML tables are used to organise information into rows and columns.

At Advanced Higher, you need to know the following table elements:

  • <table> — creates the table
  • <tr> — creates a table row
  • <th> — creates a table heading
  • <td> — creates a table data cell
<table>
  <tr>
    <th>Name</th>
    <th>Score</th>
  </tr> 
  <tr> 
    <td>Alex</td>
    <td>8</td> 
  </tr> 
</table>

 

A simple way to add a border is to include the following in your opening table tag.

<table border="1">