HTML 5 <col> 標(biāo)簽
定義和用法
<col> 標(biāo)簽為表格中的一個(gè)或多個(gè)列定義屬性值。您只能在表格或列組中使用該元素。
HTML 4.01 與 HTML 5 之間的差異
4.01 中的大多數(shù)屬性都不再得到支持。
提示和注釋
注釋:col 元素是空元素。如需創(chuàng)建列,必須在 tr 元素內(nèi)規(guī)定 td 元素。
提示:如果需要為一個(gè)或多個(gè)列規(guī)定屬性值,請使用該元素。
提示:如果需要向一個(gè)列組規(guī)定相同的屬性值,請使用 <colgroup> 元素。
例子:
<table> <col style="color:blue" /> <col span="2" style="color:yellow" /> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> </table>
屬性
屬性 | 值 | 描述 | 4 | 5 |
---|---|---|---|---|
align |
|
定義列中的單元格內(nèi)容的水平對齊方式。 | 4 | |
char | character |
定義一個(gè)字符,按照該字符對齊文本。 與 align="char" 使用。 |
4 | |
charoff |
|
規(guī)定第一個(gè)對齊字符的偏移量。 | 4 | |
span | number | 定義 <col> 應(yīng)當(dāng)橫跨的列數(shù)。 | 4 | 5 |
valign |
|
定義列中的單元格內(nèi)容的垂直對齊方式。 | 4 | |
width |
|
定義列的寬度。 | 4 |
標(biāo)準(zhǔn)屬性
class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title
如需完整的描述,請?jiān)L HTML 5 中標(biāo)準(zhǔn)屬性。
事件屬性
onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload
如需完整的描述,請?jiān)L HTML 5 中事件屬性。