FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

TableHeader colSpan Property

TableHeader Object Reference TableHeader Object

Example

Change the number of columns a cell should span:

document.getElementById("myTh").colSpan = "1";
Try it Yourself »

Definition and Usage

The colSpan property sets or returns the value of the colspan attribute.

The colspan attribute specifies the number of columns a table cell should span.

Tip: Use the rowSpan property to set or return the value of the rowspan attribute.


Browser Support

Property
colSpan Yes Yes Yes Yes Yes

Syntax

Return the colSpan property:

tableheaderObject.colSpan

Set the colSpan property:

tableheaderObject.colSpan=number

Property Values

Value Description
number Specifies the number of columns a cell should span

Technical Details

Return Value: A Number, representing the number of columns a table cell should span

More Examples

Example

Return the number of columns a specific table cell should span:

var x = document.getElementById("myTh").colSpan;

The result of x will be:

2
Try it Yourself »

Related Pages

HTML reference: HTML <th> colspan attribute


TableHeader Object Reference TableHeader Object