?
This document uses PHP Chinese website manual Release
該HTML <caption>
元素代表了表的標(biāo)題。雖然它總是<table>
的第一個(gè)后裔,但它的造型,使用CSS,可能會(huì)將它放在其他地方,相對(duì)于 table 。
內(nèi)容類(lèi)別 | 無(wú)。 |
---|---|
允許的內(nèi)容 | Flow content |
標(biāo)記省略 | 無(wú),起始和結(jié)束標(biāo)簽都是強(qiáng)制性的。 |
允許的父元素 | <table>元素,作為它的第一個(gè)后代。 |
允許的 ARIA 角色 | 無(wú) |
DOM 接口 | HTMLTableCaptionElement |
該元素包含全局屬性。
align
自 HTML4.01 起棄用自 HTML5 以來(lái)不再使用此枚舉屬性指示標(biāo)題必須如何與表格對(duì)齊。它可能有以下值:
left
,顯示在表格的左側(cè)
top
,在表格之前顯示
right
,顯示在表格的右側(cè)
bottom
,在表格下顯示
用法說(shuō)明:請(qǐng)勿使用此屬性,因?yàn)樗驯粭売茫?code><caption>元素應(yīng)使用 CSS 進(jìn)行樣式設(shè)置。為了給該align
屬性提供類(lèi)似的效果,請(qǐng)使用 CSS 屬性caption-side
和text-align
。
當(dāng)作<table>
為父元素的元素是元素<caption>
的唯一后代時(shí)<figure>
,請(qǐng)改用<figcaption>
元素。
請(qǐng)參閱<table>
頁(yè)面上的<caption>
示例
規(guī)范 | 狀態(tài) | 評(píng)論 |
---|---|---|
HTML Living Standard該規(guī)范中'<caption>'的定義。 | 生活水平 | |
HTML5該規(guī)范中'<caption>'的定義。 | 建議 | |
HTML 4.01規(guī)范該規(guī)范中'<caption>'的定義。 | 建議 |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |
align | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |
align | (Yes) | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |