HTML <caption> 標籤


實例

帶有標題的表格:

<table border="1"> <caption>Monthly savings</caption> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table>


流覽器支持

Internet Explorer Firefox Opera Google Chrome Safari

所有主流流覽器都支持 <caption> 標籤。


標籤定義及使用說明

<caption> 標籤定義表格的標題。

<caption> 標籤必須直接放置到 <table> 標籤之後。

您只能對每個表格定義一個標題。

提示:通常這個標題會被居中於表格之上。然而,CSS 屬性 "text-align" 和 "caption-side" 能用來設置標題的對齊方式和顯示位置。


HTML 4.01 與 HTML5之間的差異

HTML5 不支持 align 屬性。

HTML 4.01 已廢棄 align 屬性。


屬性

屬性 描述
align left
right
top
bottom
HTML5 不支持。HTML 4.01 已廢棄。 定義標題的對齊方式。


全局屬性

<caption> 標籤支持 HTML 的全局屬性


事件屬性

<caption> 標籤支持 HTML 的事件屬性