Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Columngroup span attribute

Columngroup span attribute

Columngroup Object Reference Columngroup Object

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

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

Attribute values

the number of columns spanned within the element.
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 Reference Columngroup Object