Change the number of columns a cell should span:
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.
The colSpan property is supported in all major browsers.
Return the colSpan property:
Set the colSpan property:
Value | Description |
---|---|
number | Specifies the number of columns a cell should span |
Return Value: | A Number, representing the number of columns a table cell should span |
---|
Return the number of columns a specific table cell should span:
The result of x will be:
HTML reference: HTML <th> colspan attribute