<caption>
marks a short description to be added to a table.
It may only be placed immediately after an opening <table> tag.
<caption> |
Yes | Yes | Yes | Yes | Yes |
The align
attribute is removed from HTML5.
The <caption> tag supports the Global Attributes in HTML.
The <caption> tag supports the Event Attributes in HTML.
caption { display: table-caption; text-align: center; }
A demo showing how to use <caption> tag.
<html>
<body>
<table>
<caption>This is the caption for this table.</caption>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
<tr>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
</table>
</body><!--from w ww . j a v a2 s . co m-->
</html>