property-value
Display/table caption — CSS reference
Generates a caption box participating in the table wrapper rather than a data cell. Use caption-side to place it above or below the grid; use the HTML caption element for semantic descriptions.
Formal Syntax & Structure
css syntaxcss
display: table-caption;Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>display/table-caption</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}body{font:16px/20px sans-serif;background:white}#a{padding:0;background:transparent;margin:10px;color:black}table{border-spacing:0}td,th{padding:0}caption{padding:0}#a{width:200px;caption-side:top}td,th{height:30px}</style><body><table id="a"><caption>Inventory</caption><tbody><tr><th scope="col" id="x">Item</th><th scope="col" id="y">Qty</th></tr><tr><td id="z">Pen</td><td>5</td></tr></tbody></table></body></html>