asp.net.ph

Skip Navigation Links

SPAN Attribute | span Property

Language References


Sets or retrieves the number of columns spanned by a COL, or the total number of columns in a COLGROUP.

Syntax


Inline <element SPAN = iSpan...>
Script object.span = iSpan ]

Possible Values


iSpan Integer value specifying the number of spanned columns.

The property is read/write with no default value.

Remarks

This attribute must specify an integer more than 0.

When used with the COLGROUP element, this attribute specifies the number of columns in a column group. Values mean the following:

  • In the absence of a span attribute, each COLGROUP defines a column group containing one column.
  • If the span attribute is set to more than 0, the current COLGROUP element defines a column group containing that number of columns.

When used with the COL element, this attribute specifies the number of columns "spanned" by the COL element; the COL element shares its attributes with all the columns it spans.

The default value for this attribute is 1 ( i.e., the COL element refers to a single column ). If the span attribute is set to more than 1, the current COL element shares its attributes with this number of columns.

The span property must be ignored in a COLGROUP object if the COLGROUP contains one or more COL objects.

Example

In the following example the COL object is set to span=2, meaning the COL will span two columns. Thus, the text will render right-aligned in those two columns.

<table border>
<COLGROUp>
<COL SPAN=2 ALIGN=RIGHT>
<COL ALIGN=LEFT>
<TBODY>
<tr>
  <td>This is the first column in the group 
    and it is right-aligned.</td>
  <td>This is the second column in the group 
    and it is right-aligned.</td>
  <td>This is the third column in the group 
    and it is left-aligned.</td>
</tr>
</table>
This is the first column in the group and it is right-aligned. This is the second column in the group and it is right-aligned. This is the third column in the group and it is left-aligned.

The following example shows the use of span with COL elements to set column alignment as well as background colors. This feature requires Microsoft® Internet Explorer® 4.0 or later.

 Show me 

Applies To

COL, COLGROUP



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note