Column span Attribute |
-- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
JavaScript Reference
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>
Column span Attribute
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
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
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";
Related Pages
HTML Reference: HTML <col> span Attribute
YouTip