Table Caption

Caption is a text string that describes the purpose of an image or a table in a web page.  A table caption appears as a heading given to a table. It is created by using <CAPTION> Tag.

Syntax of Table Caption Tag

The caption tag is given inside <TABLE></TABLE> tag. It is preferably added before the column headers and all the data rows.

<CAPTION> Caption of the Table</CAPTION>
Rest of the rows of table

Features of Caption Tag

  • Caption is a paired tag. It is mandatory to give the end tag.
  • The caption text spans all the columns.
  • A caption must be placed before all the data rows and headers of the table. Even if you place caption after some data rows of a table, it will always appear at the top.
  • Caption tag has its own attributes to control its appearance according to the rest of the data contained in the table.
  • The appearance of the caption can be controlled by using the STYLE attribute.

Attributes of Caption Tag


This attribute is used to give identification to the caption of an HTML table. The ID must be an alphanumeric string and unique for the entire web page containing the table. This ID is used in a script to manipulate the caption tag according to interaction by the user.


This attribute is used to associate caption with a class defined in a style sheet. The style sheet element is used to specify a consistent style for similar HTML elements in a web page.


Title attribute is used to set tooltip text for the Caption. When the user rests the mouse cursor on the caption, a value assigned to TITLE attribute appears in a small outlined box.


Style attribute is used to add additional styling to a caption. You can set styles as a string of CSS element and value pairs separated by semicolons. This attribute gives flexibility to the designer to apply styles for which the relevant attributes are not available. This includes font setting, alignment of text, background color of the caption etc.

HTML Caption