Description:
The HTML caption element gives a title for the table in which it is declared. It is usually displayed at the top of the table (by default) and with a bigger font size.
The HTML caption tag defines a table caption.
The <caption> tag must be inserted immediately after the <table> tag.
You can specify only one caption per table.
Tip: By default, the table caption will be center-aligned above a table. However, the CSS properties "text-align" and "caption-side" can be used to align and place the caption.
Differences Between HTML 4.01 and HTML5:
The align attribute is removed from HTML5.
Example:
| Code | View | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
<table> <caption>London's temp. / 1st half of 2010</caption> <tr> <td>January</td> <td>February</td> <td>March</td> <td>April</td> <td>May</td> <td>June</td> </tr> <tr> <td>5ºC</td> <td>1ºC</td> <td>4ºC</td> <td>8ºC</td> <td>12ºC</td> <td>15ºC</td> </tr> </table> |
|
Attributes:
| Attribute | Value | Description |
|---|---|---|
| align |
left right top bottom |
Deprecated – Specifies the position of the caption with respect to the table. |
Standard Attributes:
| Attribute | Description |
|---|---|
| class | Document wide identifier |
| dir | Specifies the direction of the text |
| id | Document wide identifier |
| title | Specifies a title to associate with the element. |
| style | Helps to include inline casecadubf style sheet. |
| lang | Sets the language code. |
Event Attributes:
| Attribute | Description |
|---|---|
| onclick | Script runs when a mouse click |
| ondblclick | Script runs when a mouse double-click |
| onmousedown | Script runs when mouse button is pressed |
| onmouseup | Script runs when mouse button is released |
| onmouseover | Script runs when mouse pointer moves over an element |
| onmousemove | Script runs when mouse pointer moves |
| onmouseout | Script runs when mouse pointer moves out of an element |
| onkeypress | Script runs when key is pressed and released |
| onkeydown | Script runs when key is pressed |
| onkeyup | Script runs when key is released |
The post HTML caption tag appeared first on .










