THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

ColumnGroup span Property

ColumnGroup Object Reference ColumnGroup Object

Example

Set the background color of the first two columns to red:

document.getElementById("myColgroup").span = "2";
document.getElementById("myColgroup").style.backgroundColor = "red";
Try it yourself »

Definition and Usage

The span property sets or returns the value of the span attribute of a column group.

The span attribute defines the number of columns a <colgroup> element should span.

Tip: To specify different properties to a column within a <colgroup>, use the Column object.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The span property is supported in all major browsers.


Syntax

Return the span property:

columngroupObject.span

Set the formMethod property:

columngroupObject.span=number

Property Values

Value Description
number Specifies the number of columns a <colgroup> element should span

Technical Details

Return Value: A Number, representing the number of columns

More Examples

Example

Return the number of columns a <colgroup> element should span:

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

The result of x could be:

2
Try it yourself »

Related Pages

HTML reference: HTML <colgroup> span attribute


ColumnGroup Object Reference ColumnGroup Object