ColumnGroup span attribute

Definition and usage

span Sets or returns the value of the span attribute of the column group.

<colgroup> span attribute Define the number of columns that the <colgroup> element should span.

Tip:To set the number of columns that the <colgroup> element should span for <colgroup> Different attributes of the columns are specified in the Column object.

See also:

HTML-Referenzhandbuch:HTML <colgroup>-Tag

Example

Example 1

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

Example 2

Return the number of columns that the <colgroup> element should span:

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

Try it yourself

Syntax

Return the span attribute of:

columngroupObject.span

Set the formMethod attribute:

columngroupObject.span = number

Attributswert

Wert Beschreibung
number Definiert die Anzahl der Spalten, die das <colgroup>-Element überbrücken soll.

Technische Details

Rückgabewert: Definiert die Anzahl der Spalten, die das <colgroup>-Element überbrücken soll.

Browserunterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützung Unterstützung Unterstützung Unterstützung Unterstützung

Verwandte Seiten

HTML-Referenzhandbuch:HTML <colgroup> span-Attribut