当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <col>标签

HTML
HTML Head
HTML Meta
HTML URLs
HTML Scripts
HTML 属性
HTML 事件
HTML URL-encode
HTML Web服务器
HTML 摘要
HTML 实例
标签列表
标准属性
事件属性
ASCII码
特殊字符
HTTP状态消息

HTML <col>标签


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 372 ::
收藏到网摘: n/a

Definition and Usage
使用方法

Defines the attribute values for one or more columns in a table. You can only use this element inside a table or a colgroup.
为表格中的一个或多个列定义属性值。你只能在表格或colgroup里使用这个元素


Differences Between HTML and XHTML
它在HTML和XHTML中的区别

In HTML the <col> tag has no end tag.
在HTML中<col>不需要结束标签

In XHTML the <col> tag must be properly closed.
在XHTML中<col>标签必须合理关闭


Tips and Notes
提示与注意点

Note: The col element is an empty element that contains attributes only. To create columns, you must specify td elements within a tr element.
注意:col为空元素,它只能包含属性。你必须在tr元素里指定td元素才能建立列。

Tip: Use this element when you want to specify different attribute values to a column inside a colgroup. Without a col element a column will inherit all its attribute values from the colgroup.
提示:当你想要给在colgroup里的列指定不同的属性值时可以使用这个元素。当col元素不存在的时候列会继承所有来自colgroup里的属性。


实例

代码 输出结果
This example shows a colgroup that has three columns of different widths:
这个实例展示了一个colgroup带有三个不同宽度的列:
<table border="1">
<colgroup span="3">
<col width="20"></col>
<col width="50"></col>
<col width="80"></col>
</colgroup>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</table>
This example shows a colgroup that has three columns of different widths:
这个实例展示了一个colgroup带有三个不同宽度的列:
1 2 3 4


可选属性

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>
注意:优先级高于在<colgroup>里的设置

STF

标准属性

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.
查看完整的描述

评论 (0) All

登陆 | 还没注册?