Web Development HTML Guide - Learn HTML
Developer Tutorials
ASP
CGI & Perl
CSS
Flash
HTML
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML



Developer Manuals
Learn HTML
Learn PHP
Learn MySQL
Learn CSS
Learn Pear


Developer Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Developer Resources
Developer Tools
Developer News
Developer Forums
Developer Content
Developer Book Reviews
Survey Software

Web Hosting Directory
Budget Web Hosting
ColdFusion Hosting
Dedicated Servers
Domain Hosting
E-Commerce Hosting
Email Hosting
Free Web Hosting
Linux Web Hosting
Managed Hosting
Reseller Hosting
Small Business Hosting
Windows Web Hosting

<COL ...>

  • SPAN: how many columns this affects
  • ALIGN: horizontal alignment
 
  • WIDTH: width of the column
  • BGCOLOR: background color of the column

<COL ...> sets properties for a column of table cells. <COL ...> is an HTML 4.0 tag. Currently only MSIE and Netscape 6 recognize it.

<COL ...> goes after the <TABLE ...> tag and before any <TR ...>, <THEAD ...>, or <TBODY ...> elements. (It may go inside a <COLGROUP ...> element but it doesn't have to.) Each <COL ...> defines the properties of one column, unless you use SPAN to indicate that it is for more than one column. So the first <COL ...> sets the properties for the first column, the second <COL ...> sets the properties for the second column, and so on.

For example, the following code uses three <COL ...> tags to set properties of the cells in the first, second, and third columns of the table. The first <COL ...> doesn't do anything except serve a placeholder for the first column. The second <COL ...> uses the ALIGN attribute to right align all the cells in the second column. The third <COL ...> uses STYLE to set the styles of the cells in the third column so that the font color is red:

<TABLE BORDER CELLPADDING=5>

<COL>
<COL ALIGN=RIGHT>
<COL STYLE="color:red">

<TR> <TH>Expense</TH> <TH>Price</TH> <TH>Status</TH> </TR>
<TR> <TD>office suite</TD> <TD>1,343.56</TD> <TD>rental</TD> </TR>
<TR> <TD>cabling</TD> <TD>1.25</TD> <TD>installed</TD> </TR>
</TABLE>

which gives us this table:

Expense Price Status
office suite 1,343.56 rental
cabling 1.25 installed

It's important to be absolutely clear on this point: <COL ...> does not create columns. It merely sets the properties of columns that will be defined later in the code. Cells are not "contained" in <COL ...> elements, they just set attributes which are applied to the cells in that column position.


Copyright Idocs, Inc. Written by Miko Sullivan











About the NetVisits, Inc Network | Advertise
Developer Tutorials hosted by HostGator.
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: