HTML 開發(fā)手冊
/ <col>
<col>
HTML <col> 標(biāo)簽 實(shí)例 <colgroup> 和 <col> 標(biāo)簽為表格中的三個(gè)列設(shè)置了背景色: <table border='1'> <colgroup> &..
HTML <col> 標(biāo)簽
實(shí)例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <table border="1"> <colgroup> <col span="2" style="background-color:red"> <col style="background-color:yellow"> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> <tr> <td>5869207</td> <td>My first CSS</td> <td>$49</td> </tr> </table> </body> </html>
運(yùn)行實(shí)例 ?
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例
瀏覽器支持
所有主流瀏覽器都支持 <col> 標(biāo)簽。
標(biāo)簽定義及使用說明
<col> 標(biāo)簽規(guī)定了 <colgroup> 元素內(nèi)部的每一列的列屬性。
通過使用 <col> 標(biāo)簽,可以向整個(gè)列應(yīng)用樣式,而不需要重復(fù)為每個(gè)單元格或每一行設(shè)置樣式。
HTML 4.01 與 HTML5之間的差異
HTML5 中不再支持 HTML 4.01 中的大部分屬性。
HTML 與 XHTML 之間的差異
在 HTML 中,<col> 標(biāo)簽沒有結(jié)束標(biāo)簽。
在 XHTML 中,<col> 標(biāo)簽必須被正確的關(guān)閉。
屬性
屬性 | 值 | 描述 |
---|---|---|
align | left right center justify char | HTML5 不支持。規(guī)定與 <col> 元素相關(guān)的內(nèi)容的水平對齊方式。 |
char | character | HTML5 不支持。規(guī)定根據(jù)哪個(gè)字符來對齊與 <col> 元素相關(guān)的內(nèi)容。 |
charoff | number | HTML5 不支持。規(guī)定第一個(gè)對齊字符的偏移量。 |
span | number | 規(guī)定 <col> 元素應(yīng)該橫跨的列數(shù)。 |
valign | top middle bottom baseline | HTML5 不支持。規(guī)定與 <col> 元素相關(guān)的內(nèi)容的垂直對齊方式。 |
width | % pixels relative_length | HTML5 不支持。Specifies the width of a <col> element |
全局屬性
<col> 標(biāo)簽支持 HTML 的全局屬性。
事件屬性
<col> 標(biāo)簽支持 HTML 的事件屬性。