Skip to content

Tables

The tables are used to show table data, e.g. exchange rates. Tables should not be used for page layout.

The basic tags for building tables are

  • <table> - used to embed a table on a page
  • <tr> - defines a new row
  • <td> - defines a standard cell
  • <th> - like <td>, defines the cell that is the header of the table.

In turn, the attributes of rowspan and colspan serve to group the cells in a row and vertically respectively. The following example shows the use of these tags:

<table>
    <tr>
        <th>Training course</th>
        <th>Score</th>
        <th colspan="2">Dates</th>
    </tr>
    <tr>
        <td>Java</td>
        <td>10/10</td>
        <td>06.07.2020</td>
        <td>08.08.2020</td>
    </tr>
    <tr>
        <td>Advanced Spring</td>
        <td>11/10 :)</td>
        <td>12.12.2020</td>
        <td>19.12.2020</td>
    </tr>
</table>

The result will be:

table

A great place to test and visualize HTML code can be found here.