40 of 133 menu

The caption tag

The caption tag is used to create a caption for the entire HTML table. This caption is the text that is displayed by default before the table and describes its contents.

This tag can only be placed inside the table tag, and immediately after the opening tag.

Example

Let's add a caption caption to the table:

<table> <caption>this is the title of the entire table</caption> <tr> <th>Name</th> <th>Surn</th> <th>Salary</th> </tr> <tr> <td>name1</td> <td>surn1</td> <td>200$</td> </tr> <tr> <td>name2</td> <td>surn2</td> <td>1000$</td> </tr> </table> table, td, th { border: 1px solid black; }

:

See also

  • tag table,
    which creates a table
  • tag title,
    which sets the title of the entire page
enru