Skip to content

Tables

Tables are used to present tabular data, e.g. exchange rates. The table not should be used to build the page layout.

The basic tags for building tables are:

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

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

<table>
    <tr>
        <th>Training</th>
        <th>Score</th>
        <th colspan="2">Date</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 as follows:

table

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