The caption Tag is used to specify the caption of a table. This tag will be inserted just after the <table> tag. Only one caption can be specified for one table. It is by default aligned to center.
Below is the attribute that is used to align the caption.
<caption align = "value" > </caption>
where value can be:
- left: Used to align the caption to the left of the table.
- center: Used to align the caption at the top-center of the table.
- right: Used to align the caption to the right of the table.
Below programs illustrate the <caption> tag in HTML:
Example-1: Adding a caption to the table i.e. by default aligned to the center.
Example-2: Adding a caption to the table and adding align attribute to it to align the caption to the left/right.
Supported Browsers: The browser supported by HTML Caption Tag are listed below:
- Google Chrome
- Internet Explorer
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.