5 out of 9 rated this helpful - Rate this topic

col element | col object

[This documentation is preliminary and is subject to change.]

Specifies column-based defaults for the table properties.

Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5HTML 4.01 Specification, Section 11.2.4

Standards information

HTML information

Closing Tagforbidden
CSS Displayblock

DOM Information

Inheritance Hierarchy

 Node
  Element
   HTMLElement
     col

Remarks

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 following example.

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 Building Tables Dynamically.

Windows Internet Explorer 8 will only render tables up to 1000 columns. To force Windows Internet Explorer 7 rendering mode, see How Do I Take Advantage of the New Features in Internet Explorer 8.

Examples

This example uses the col element to specify characteristics for default columns in a table.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/colEX.htm



<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>


See also

colGroup

 

 

Build date: 3/8/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ