Posts in current category

HTML5 <caption> tag

May 03, 2021 13:20 HTML5

Table of contents


Html5 is used to define a title for a table, using the following example:

Table with title:

<table border="1"> 
<caption>Monthly savings</caption> 
<tr> <th>Month</th> <th>Savings</th> </tr> 
<tr> <td>January</td> <td>$100</td> </tr>
Try it out . . .

Browser support

HTML5 <caption> tag HTML5 <caption> tag HTML5 <caption> tag HTML5 <caption> tag HTML5 <caption> tag

All major browsers support the hashtag.

Label definition and instructions for use

The label defines the title of the table.

The label must be placed directly after the label.

You can define only one title for each table.

Tip: Usually this title is centered on the table. However, the CSS properties text-align and caption-side can be used to set the alignment and display position of the title.

The difference between HTML 4.01 and HTML5

HTML5 does not support the align property.

HTML 4.01 has discarded the align property.


Property Value Describe
align (abandoned)
HTML5 is not supported. H TML 4.01 is obsolete. Defines the alignment of the title.

Description of use: When the element is the parent element of the element, and the caption is the sole descendant of the element, replace the caption element with the element

Global properties

The label supports the global properties of HTML.

The event property

The tag supports the event properties of HTML.