当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <colgroup>标签
Defines groups of table columns. With this element, you can group columns for formatting. This element is only valid inside the <table> tag.
定义表格列组。使用这个元素可以格式化列组。这个元素只在<table>标签中使用才有效。
NONE
无
Note: The colgroup element is an empty element that contains attributes only. To create columns, you must specify td elements within a tr element.
注意:colgroup元素为空元素,只包含属性。你必须在tr元素里指定td元素才能建立列。
This example creates a table with four columns, with the first three columns in one colgroup, and the last column in the second colgroup:
该例将建立一个带有四个列的表格。前三个列将并在一个colgroup中,剩下的一个在第二个colgroup:
代码 | 输出结果 | ||||
---|---|---|---|---|---|
<table border="1"> <colgroup span="3" style="color:#FF0000;"> </colgroup> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> </table> |
|
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)
属性名 | 值 | 描述 | DTD |
---|---|---|---|
align | right left center justify char | Defines the horizontal alignment of the content in the table cell, in the column 定义表格单元内或是列内文字的的水平对齐方向 | STF |
char | character | Defines a character to use to align text on (use with align="char") 向某字对齐(得同时用上align="char") | STF |
charoff | pixels % | Defines an alignment offset to the first character to align on, as set with char 取消向某字对齐 | STF |
span | number | Defines the number of columns the <col> should span 定义所要跨度列的数量 | STF |
valign | top middle bottom baseline | Defines the vertical alignment of the content in the table cell, in the column 定义表格单元内或是列内文字的垂直对齐 | STF |
width | % pixels relative_length | Defines the width of the column. 定义列的宽度 Note: Overrides the width set in <colgroup> |
id, class, title, style, dir, lang, xml:lang |
For a full description, go to Standard Attributes.
查看完整的描述
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup |
For a full description, go to Event Attributes.
查看完整的描述