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

Column span attribute

Column span attribute

Column Object Reference Column Object

Example

Return the number of columns spanned by the element (i.e., the value of span):

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

x The output result is:

2

Try it »


Definition and usage

The span attribute is used to set or return the value of the column's span attribute.

The span attribute defines the number of columns spanned by the element.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the span attribute.


Syntax

Return the span attribute:

columnObject

.span

Set the formMethod attribute:

columnObject

.span=

number

Attribute values

the number of columns spanned by the element
Value Description
number describes

Technical description

Return value: a number representing 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("myCol").span="2";

document.getElementById("myCol").style.backgroundColor="red";

Try it »


Related pages

HTML Reference Manual: HTML span attribute


Column Object Reference Column Object