Prop Tableheader Colspan
# HTML DOM TableHeader colSpan Property
[ TableHeader Object](#)
## Example
Change the number of columns a cell spans:
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 (#) property to set or return the value of the rowspan attribute.
* * *
## Browser Support

The colSpan property is supported by all major browsers.
* * *
## 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 specified table cell should span:
```javascript
var x = document.getElementById("myTh").colSpan;
document.getElementById("demo").innerHTML=x;
The _x_ output will be:
2
[Try it yourself Β»](#)
* * *
## Related Articles
HTML Reference: [HTML colspan attribute](#)
* * TableHeader Object](#)
YouTip