YouTip LogoYouTip

Prop Col Span

Column span Attribute |

-- Learning is not just about technology, but also about dreams!

JavaScript Reference

Overview

JavaScript Objects

JavaScript Array Object JavaScript Boolean Object JavaScript Date Object JavaScript Math Object JavaScript Number Object JavaScript String Object JavaScript RegExp Object JavaScript Global Properties/Functions JavaScript Operators JavaScript Error

Browser Objects

Window Object Navigator Object Screen Object History Object Location Object Storage Object

DOM Objects

HTML DOM Document Object HTML DOM Element Object HTML DOM Attribute Object HTML DOM Event Object HTML DOM Console Object CSSStyleDeclaration Object DOM HTMLCollection

HTML Objects

<a> <area> <audio> <base> <blockquote> <body> <button> <canvas> <col> <colgroup> <datalist> <del> <details> <dialog> <embed> <fieldset> <form> <iframe> <frameset > <img> <ins> <input> - button <input> - checkbox <input> - color <input> - date <input> - datetime <input> - datetime-local <input> - email <input> - file <input> - hidden <input> - image <input> - month <input> - number <input> - range <input> - password <input> - radio <input> - reset <input> - search <input> - submit <input> - text <input> - time <input> - url <input> - week <keygen> <link> <label> <legend> <li> <map> <menu> <menuItem> <meta> <meter> <object> <ol> <optgroup> <option> <param> <progress> <q> <script> <select> <source> <style> <table> <td> <th> <tr> <textarea> <title> <time> <track> <video>

<canvas>

<colgroup>

Column span Attribute

Column Object Reference Column Object

Example

Return the number of columns a <col> element spans (i.e., the value of span):

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

x output result is:

2

Try it yourself Β»


Definition and Usage

The span property is used to set or return the value of the span attribute of a column.

The span property specifies the number of columns a <col> element should span.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The span property is supported by all major browsers.


Syntax

Return the span property:

columnObject.span

Set the span property:

columnObject.span=number

Property Values

Value Description
number Specifies the number of columns a <col> element should span

Technical Details

Return Value: A number, representing the number of columns

More Examples

Example

Set the background color of the first two columns to red using the span and backgroundColor properties:

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

Try it yourself Β»


Related Pages

HTML Reference: HTML <col> span Attribute


Column Object Reference Column Object

<canvas>

<colgroup>

iFlytek Coding Plan includes free model call quotas, DeepSeek, GLM, Kimi, MiniMax, one-stop experience and deployment platform. Configuration Guide Β₯3.9/month Subscribe Now

Click to Share Notes

← Dom Obj ColgroupDom Obj Col β†’