HTML Caption Tag

HTML Caption TagHTML Caption Tag <caption> is used to provide a caption to a table in HTML 5. The HTML Caption Tag must be places just after the HTML Table Tag.

Only one Caption is allowed per table in an HTML webpage. The caption of a table is aligned as center by default by HTML Caption Tag.

Caption Tag align attribute is removed in HTML 5 and is deprecated in HTML 4.01. Caption tag is a closed tag and needs closing Caption Tag </caption>

HTML Caption Tag Syntax

<caption> Table Caption Goes Here </caption>
Table rows and data goes here..

HTML Caption Tag Attributes

HTML Caption Tag Attribute Value Description
align left, right, top, bottom Specifies the alignment of the caption of table in HTML. Not Supported in HTML 5.

HTML Caption Tag supports all HTML Global Attributes and HTML Event Attributes.

HTML Caption Tag Example

HTML Caption Tag Code Output
[sourcecode language=”html”]</pre>
<table border="1"><caption>Top 3 Ranks are</caption>
Top 3 Ranks are
Rank Name
John 1
Jack 2
Jill 3

The above HTML Caption Tag example shows that by default the caption of the table is aligned at center of table.

HTML Caption Tag Supporting Browser

S. No. Browser Supported(Yes/No)
1 Internet Explorer Yes
2 Firefox Yes
3 Google Chrome Yes
4 Opera Yes
5 Safari Yes

Leave a Reply

Your email address will not be published. Required fields are marked *