说明基于列的表格缺省属性。
Specifies column-based defaults for the table properties.
COL 元素可嵌套于 COLGROUP 元素内。如果是这样的话,嵌套的 COL 属性将覆盖 COLGROUP 属性。
你可使用元素 COL 和 COLGROUP 用于类似的目的。但是,你必须使用 COLGROUP 元素来决定表格内部分隔线(rules)应该处于的位置。见下面的的示例。
使用 SPAN 属性可以指定 COLGROUP 定义的表格列数。该属性的缺省值为 1。
TABLE 对象及其关联元素有一个独立的表格对象模型,该模式使用不同于常规对象模型的方法。要获得关于表格对象模型更多的信息,请参看如何动态生成表格。
此元素在 Internet Explorer 3.0 及以上版本的 HTML 中可用,在 Internet Explorer 4.0 及以上版本的脚本中可用。
此元素是块元素。
此元素不需要关闭标签。
COL elements can be nested within a COLGROUP element. If this is done, the nested COL attributes override the COLGROUP attributes.
You can use the COL and COLGROUP elements for similar purposes. However, you must use the COLGROUP element to determine where table internal dividing lines (rules) should go. This is illustrated in the example below.
Use the SPAN attribute to specify the number of table columns that the COLGROUP defines. This attribute has a default value equal to one.
The table object and its associated elements have a separate table object model, which uses different methods than the general object model. For more information on the table object model, see How to Build Tables Dynamically.
This element is available in HTML as of Internet Explorer 3.0, and in script as of Internet Explorer 4.0.
This element is a block element.
This element does not require a closing tag.
下面的例子使用了 COL 元素说明表格中缺省列的特征。
This example uses the col element to specify characteristics for default columns in a table.
<HTML> <BODY> <TABLE BORDER="2" RULES="groups"> <!-- RULES is set to "groups", which has no effect in this sample. For this attribute to work, you must use COLSPAN to define the groups of columns.--> <COL SPAN="2" STYLE="color:red"> <COL STYLE="color:blue"> <TR> <TD>This column is in the first group.</TD> <TD>This column is in the first group.</TD> <TD>This column is in the second group.</TD> </TR> <TR> <TD>This column is in the first group.</TD> <TD>This column is in the first group.</TD> <TD>This column is in the second group.</TD> </TR> </TABLE> </BODY> </HTML>