HTML5 <caption> Tag

The HTML <caption> tag is used to represent the title of a table. Keep in mind that this should always be the first descendant of a <table> tag. However, you can change its styling and place it elsewhere relative to the table using CSS.

The only content permitted inside this element is flow content. Both the starting and ending tag are mandatory for this element. The parent of the <caption> tag can only be a <table> element, with the <caption> tag as its first descendant.

The following style is applied to this element by default:

caption {
  display: table-caption;
  text-align: center;
}

Attributes

align

This attribute is deprecated since HTML4.01 and obsolete since HTML5. You should not use this attribute, as it has been deprecated. The <caption> element should be styled using CSS. To give a effect similar to the align attribute, use the the CSS properties caption-side and text-align.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top