Columngroup span attribute
Example
Return the number of columns spanned by the element:
var x = document.getElementById("myColgroup").span;
x The output result is:
2
Try it »
Definition and usage
The span attribute sets or returns the value of the column group's span attribute.
The span attribute defines the number of columns spanned by the element.
Tip: To describe the attributes of different column elements within the group, use Column object.
Browser support

All major browsers support the span attribute.
Syntax
Return the span attribute:
columngroupObject
.span
Set the formMethod attribute:
columngroupObject
.span=
number
Attribute values
| Value | Description |
|---|---|
| number | describes |
Technical description
| Return value: | Return the column count |
|---|
More examples
Example
Use the span and backgroundColor attributes to set the background color of the first two columns to red:
document.getElementById("myColgroup").span="2";
document.getElementById("myColgroup").style.backgroundColor="red";
Try it »
Related pages
HTML Reference Manual: HTML span attribute
Columngroup Object