👀 Live Preview
Simple product table with axis and headers attributes:
| Category | Value |
|---|---|
| Product 1 | $10 |
| Product 2 | $20 |

The axis attribute is an HTML feature primarily used with the <td> (table data) and <th> (table header) elements to define conceptual categories for cells in a table. This attribute enhances the accessibility and structure of tables, providing valuable information to assistive technologies and users.
Not row numbers.
Table cells only.
Pair with ids.
Modern alternative.
Set dynamically.
HTML5 legacy.
axis AttributeThe axis attribute is used to indicate the category of data represented by a cell in a table. It helps in associating table cells with specific conceptual groups, making it easier for screen readers and other assistive technologies to navigate and interpret tabular data in complex, multi-dimensional layouts.
The axis attribute is not recommended for new projects. Browsers rarely expose it. Use scope, headers, and semantic <th> markup instead.
Add axis to a <td> or <th> cell with one or more category names:
<th id="category" axis="category">Category</th>
<td headers="category" axis="category">Product 1</td><td> and <th> elements.headers and id on header cells for clearer relationships.The axis attribute accepts a comma-separated list of category names that describe the conceptual group a cell belongs to. For example:
axis="category" or axis="value" labels the type of data in that cell.axis="product, item" assigns the cell to more than one conceptual axis.student_info, region, or quarter that describe your data model.Despite older misconceptions, axis values are not row or column numbers. They are descriptive category names defined by the author.
<th axis="category">Product</th>
<th axis="value">Price</th>
<td axis="product, item">Widget</td>| Use Case | Example Value | Notes |
|---|---|---|
| Column category header | axis="category" | On <th> |
| Data cell group | axis="value" | On <td> |
| Multi-axis cell | axis="region, quarter" | Comma-separated |
| Modern replacement | scope="col" | Preferred in HTML5 |
| Header association | headers="id1 id2" | Links td to th ids |
| Applicable elements | td, th | Table cells only |
| Element | Supported? | Notes |
|---|---|---|
<th> | Yes | Header cells |
<td> | Yes | Data cells |
<table> | No | Not a cell element |
<tr> | No | Apply on individual cells |
Implementation example with category names and dynamic JavaScript axis.
Simple product table with axis and headers attributes:
| Category | Value |
|---|---|
| Product 1 | $10 |
| Product 2 | $20 |
Let’s consider an example of using the axis attribute in an HTML table:
<table>
<tr>
<th id="category" axis="category">Category</th>
<th id="value" axis="value">Value</th>
</tr>
<tr>
<td headers="category" axis="category">Product 1</td>
<td headers="value" axis="value">$10</td>
</tr>
<tr>
<td headers="category" axis="category">Product 2</td>
<td headers="value" axis="value">$20</td>
</tr>
</table>In this example, the <th> elements have axis attributes set to category names that describe their column role. The <td> elements use matching axis values and headers attributes referencing the corresponding header ids.
While the axis attribute is primarily static, you can dynamically modify table structures using JavaScript. This can be useful when dealing with dynamic data or user interactions that require altering the table’s accessibility properties. Here’s a basic example:
<td id="dynamicCell">Apple</td>
<script>
// Dynamically set the axis attribute for a table cell
document.getElementById("dynamicCell").axis = "product, item";
</script>In this script, the axis attribute of a table cell with the id dynamicCell is dynamically set to "product, item". This can be helpful when modifying table structures based on user inputs or application logic.
scope on <th> and headers on complex cells.<thead>, body rows in <tbody>, and add a <caption>.Assign comma-separated axis names to td and th cells.
Related cells use the same category tokens to form conceptual groups.
In theory, browsers could let users browse cells by axis category.
In practice, use scope and headers for reliable accessibility today.
The axis attribute is recognized in HTML parsers but is obsolete in HTML5 and was never widely implemented by browsers or assistive technologies.
Use scope and headers for accessible tables instead.
Bottom line: Learn axis for legacy HTML knowledge; build new tables with scope and headers.
scope="col" or scope="row" on header cellsheaders pointing to th ids<caption> to every data tableaxis attribute to provide additional semantic information to tables, especially when dealing with complex data relationships in legacy documents.axis attribute to maintain table structure integrity.scope and headers enhance accessibility and usability.The axis attribute is a valuable tool for understanding how HTML tables were designed to support multi-dimensional categorization. By learning how it was intended to work, you gain insight into table accessibility history.
For new projects, prefer scope, headers, semantic <th> cells, and clear captions. These patterns deliver reliable accessibility in today’s browsers.
axisBookmark these before working with HTML tables.
Category tokens.
ValuesCells only.
ScopePair with ids.
LinkDynamic JS.
ScriptUse scope.
HTML5<td> and <th> table cell elements.category or product, item, not numeric indices.scope on header cells and headers on data cells for accessible tables.cellElement.axis = "product, item" at runtime when updating legacy tables dynamically.scope, headers, proper <th> markup, <caption>, and semantic table structure.Practice the legacy axis attribute and learn modern scope / headers patterns in the Try It editor.
5 people found this page helpful