In JavaScript, the ariaColSpan property of Element reflects the aria-colspan attribute, which defines how many columns a cell or gridcell spans in a table, grid, or treegrid (MDN).
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use el.ariaColSpan. Start with this line.
JavaScript
el.ariaColSpan
Call
What it does
el.ariaColSpan
Primary signature.
Built into the browser. Read or assign el.ariaColSpan — no import required.
Library declarations
JavaScript
el.ariaColSpan
Parameters
Parameter
Description
ariaColSpan
Optional. Width in columns
Positive integer
Required. Value ≥ 1; default is 1
Return Value
Return Value
Description
*
The current value of el.ariaColSpan.
JavaScript Examples
Example 1 — Read ariaColSpan
MDN-style spanning cell: read the reflected string integer.
JavaScript
const el = document.getElementById("spanning-column");
console.log(el.ariaColSpan); // "2"
Read again. Confirms property and attribute updated.
Keep layout valid. Do not overlap the next cell (MDN).
Example 3 — ARIA Grid Column Header
Span a header across two columns in a custom grid (not a native table).
JavaScript
const h = document.getElementById("player");
h.ariaColIndex = "2";
h.ariaColSpan = "2"; // Last Name + First Name
console.log(h.ariaColIndex); // "2"
console.log(h.ariaColSpan); // "2"
Set the start.ariaColIndex = "2" is the first column of the span.
Set the width.ariaColSpan = "2" covers two columns.
Use on ARIA headers/cells. This is where aria-colspan shines.
Prefer native tables when a real <table> is enough (MDN).
Compatibility
Browser Support
Element.ariaColSpan is Baseline Widely available (MDN: across browsers since October 2023). It is not Deprecated, Experimental, or Non-standard.
✓ Baseline Widely available
Element.ariaColSpan
Reflects aria-colspan as a string integer for how many columns a cell covers. Prefer HTML colspan on native tables.
BaselineWidely available
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
ariaColSpanBaseline
Bottom line: Safe for modern apps. Use string integers ≥ "1", avoid overlaps, and prefer native colspan when you have a real
.
Frequently Asked Questions
It reflects the aria-colspan attribute as a string integer that defines how many columns a cell or gridcell spans in a table, grid, or treegrid (MDN).
No. MDN marks Element.ariaColSpan as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
A string that contains an integer (for example "2" or "3"), not a Number type. Default assumed span is 1.
On a native <td>/<th>, use the HTML colspan attribute. aria-colspan / ariaColSpan is for ARIA table/grid/treegrid cells that are not native table cells — MDN says aria-colspan on a cell inside a real <table> is ignored.
ariaColIndex is the starting column (1-based). ariaColSpan is how many columns that cell covers from that start.
Yes. Reading and writing ariaColSpan updates the reflected aria-colspan attribute.