Column span attribute

Definition and usage

span Sets or returns the value of the column's span attribute.

span attribute of <col> Defined the number of columns the <col> element should span.

See also:

HTML Reference Manual:HTML <col> Tag

Example

Example 1

Set or return the value of the column's span attribute:

document.getElementById("myCol").span = "2";
document.getElementById("myCol").style.backgroundColor = "red";

Try it yourself

Example 2

Return the number of columns the <col> element should span:

var x = document.getElementById("myCol").span;

Try it yourself

Syntax

Return the span attribute of:

columnObject.span

Set formMethod Attribute:

columnObject.span = number

Attribute Value

Value Description
number Specifies the number of columns the <col> element should span. Negative values are not allowed.

Technical Details

Return Value: Number, representing the number of columns.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <col> span Attribute