Columngroup spanProperty

Columngroup 对象参考手册Columngroup ObjectColumngroup Object

Example

Return the number of columns spanned by the <colgroup> element:

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

xThe output result is:

2

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 spanned by the <colgroup> element.

Tip:To describe the attributes of different column elements in <colgroup>, useColumnobject.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the span attribute.


Syntax

Return the span attribute:

columngroupObject.span

Set the formMethod attribute:

columngroupObject.span=number

Property Values

Value Description
number Describes the number of columns spanned by the <colgroup> element.

Technical Details

Return Value: Returns the number of columns


More Examples

Example

Use the span and backgroundColor properties 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 Yourself »


Related Pages

HTML Reference:HTML <colgroup> span Attribute


Columngroup 对象参考手册Columngroup ObjectColumngroup Object

Other Extensions