Tables
HTML <caption> element
Provides a table's title or caption. Place it first inside the table, before column groups and row groups. Use a concise caption that names the data table. It can supply an accessible table name; use separate explanatory prose for extensive instructions or interpretation. It accepts global HTML attributes; individual global features may be inapplicable or restricted.
Formal Syntax & Structure
html syntaxhtml
<caption>Table title</caption>Return Value
HTMLTableCaptionElement
Content model: Flow content, but no descendant table.
Working Example
Example Snippethtml
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>HTML example</title> </head> <body> <table> <caption>Stock</caption> <tr> <th scope="col">Item</th> </tr> <tr> <td>Book</td> </tr> </table> </body></html>