Skip to content
Related Articles

Related Articles

Improve Article

HTML <caption> Tag

  • Difficulty Level : Basic
  • Last Updated : 09 Feb, 2021

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 the center.


<caption align = "value" ></caption>

Attributes: This tag accepts a single attribute as mentioned above and described below.

  • align: This attribute is used to specify the alignment of text content.

Below examples illustrate the <caption> tag in HTML:

Example 1: Adding a caption to the table i.e. by default aligned to the center. 


<!DOCTYPE html> 
    <h2>HTML <Caption> Tag</h2
        <!-- Adding caption to the table -->


Example 2: Adding a caption to the table and adding align attribute to it to align the caption to the left.


<!DOCTYPE html>
    <h2>HTML <Caption> Tag</h2>
      <!-- Adding a caption to the table 
            and aligning it to the left-->
      <caption style="text-align: left">



Supported Browsers: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :