<caption> Caption (X)HTML Element - (X)HTML :: webDev

<caption>

The <caption> element provides a means for labeling the following <table>’s content in a visual manner (unlike the <table>’s <summary> attribute, which is non-visible). It has one element-specific attribute, <align>, which is very rudimentary and not entirely supported (it’s also deprecated, so it should generally be avoided).

The <caption> element can only be used once per <table> and must immediately follow the <table> start tag.

While the <caption> element seems like the most appropriate markup for labeling a <table>, many people instead choose to precede <table>s with heading elements 1-6, <h1>-<h6> (for example, an <h3> element). This makes it easier for people using assistive technology, such as screen readers, to jump from heading to heading in the document, and arguably offers more semantic information than the <caption>, which doesn’t provide any indication of importance or hierarchy within the document.

The <caption> element should be used for providing a short heading for the <table; it should not be used to provide a description of the <table’s structure, as you might do with the table summary attribute.

<caption> Caption (X)HTML Element - (X)HTML :: webDev