HTML axis Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The axis attribute belonged on <td> and <th>. In HTML 4 it was meant to place a cell into conceptual categories (an “axis” of related cells) so a user agent could group or query them.

Do not use it in new pages. Prefer scope on headers and headers when cells need explicit associations. For script-only categories, use data-* attributes instead.

Deprecated.

MDN lists axis as deprecated on both <td> and <th>. It is kept here for reading legacy markup and migrating tables — not for new designs.

Little real browser behavior.

Engines mostly expose the attribute in the DOM. They do not provide a useful built-in UI or screen-reader feature based on axis.

HTML Syntax

syntax.html
<td|th axis=" category-list">

Historical form only. New tables should omit axis.

Attribute Values

What authors used to put in axis, and what to use now:

Value / approachDescriptionTry it
Category name(s)HTML 4: comma-separated names (e.g. expenses,meals)Try it
Space-separated tokensMDN’s deprecated note also describes space-separated stringsTry it
scope on <th>Modern: row, col, rowgroup, colgroupTry it
headers + idModern: link a cell to specific header cell idsTry it
data-* categoriesCustom labels for your own scripts (not assistive-tech headers)Try it

Live Preview

Legacy demo: pick a category to highlight cells whose deprecated axis value contains that name. Visual only — browsers do not do this natively.

Script reads axis for teaching. Prefer scope / headers in real projects.

Legacy table
Sample expenses (deprecated axis demo)
ItemAmount
Lunch$12
Train$40
Coffee$4

Showing all cells.

HTML Examples

Example 1 is historical only. Examples 2–3 show what to write instead.

Example 1 — Legacy axis Categories (Do Not Ship)

How authors once tagged cells with category names.

HTML
<table>
  <tr>
    <th axis="expenses">Item</th>
    <th axis="expenses">Cost</th>
  </tr>
  <tr>
    <td axis="expenses,meals">Lunch</td>
    <td axis="expenses,meals">$12</td>
  </tr>
  <tr>
    <td axis="expenses,travel">Taxi</td>
    <td axis="expenses,travel">$18</td>
  </tr>
</table>
Try It Yourself

How It Works

  1. Put category labels in axis on each cell (comma-separated in HTML 4 style).
  2. Intent: mark “meals” vs “travel” under a shared “expenses” idea.
  3. Reality: the browser draws the same table; almost no UA feature consumes these names.
  4. Status: deprecated — keep only for understanding old documents.

Example 2 — Modern Replacement (scope + headers)

Use real header associations instead of category strings.

HTML
<table>
  <caption>Team scores</caption>
  <thead>
    <tr>
      <th id="player" scope="col">Player</th>
      <th id="points" scope="col">Points</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th id="ada" scope="row">Ada</th>
      <td headers="ada points">12</td>
    </tr>
    <tr>
      <th id="lin" scope="row">Lin</th>
      <td headers="lin points">9</td>
    </tr>
  </tbody>
</table>
Try It Yourself

How It Works

  1. scope="col" / scope="row" tell which cells a <th> describes.
  2. Give headers an id when relationships are complex.
  3. headers="…" on a <td> lists those ids explicitly for assistive tech.
  4. No axis. Accessibility comes from structure, not category keywords.

Example 3 — Custom Categories with data-*

If your own script needs tags like the old axis idea, store them in data attributes.

HTML
<table id="costs">
  <tr>
    <th scope="col">Item</th>
    <th scope="col">Cost</th>
  </tr>
  <tr>
    <td data-category="meals">Lunch</td>
    <td data-category="meals">$12</td>
  </tr>
  <tr>
    <td data-category="travel">Taxi</td>
    <td data-category="travel">$18</td>
  </tr>
</table>

<script>
  document.querySelectorAll('#costs [data-category="meals"]').forEach((cell) => {
    cell.classList.add("is-meal");
  });
</script>
Try It Yourself

How It Works

  1. Replace axis="meals" with something like data-category="meals".
  2. Keep proper <th scope> for accessibility; data attributes are for your app logic.
  3. Query with CSS/JS ([data-category="meals"]) the way old scripts might have read axis.
  4. Update any legacy JS that called getAttribute("axis").

Edge Cases & Pitfalls

Treat every remaining axis as technical debt.

deprecated

Not valid for new HTML

Validators and style guides flag it. Remove on rewrite; do not copy into new components.

a11y

No substitute for real headers

Screen readers need <th>, scope, and sometimes headers — not category keywords.

migration

No 1:1 HTML replacement

Category grouping has no dedicated HTML5 attribute. Use table semantics and/or data-* + JS.

docs

Comma vs space lists

Older docs show commas; some modern notes say spaces. Irrelevant for new work — delete the attribute.

scope

Do not put scope on <td>

MDN: scope on data cells is also deprecated. Use scope on <th> only; use headers on <td> when needed.

Browser Support

axis is a deprecated HTML attribute on table cells. It is not a feature you should depend on in modern apps.

✓ Deprecated · Legacy only

axis

Parsers may still expose the attribute in the DOM, but there is no useful cross-browser behavior for authors. Treat support as historical.

0% Recommended for new work
Google Chrome Parses · no useful UX
Legacy only
Mozilla Firefox Parses · no useful UX
Legacy only
Apple Safari Parses · no useful UX
Legacy only
Microsoft Edge Parses · no useful UX
Legacy only
Opera Parses · no useful UX
Legacy only
Internet Explorer Legacy attribute
Legacy only
axis Deprecated — do not use

Bottom line: Safe only as “ignore when reading old HTML.” For new tables, use scope, headers, and clear th markup.

Key Takeaways

  • Was: category labels on td/th in HTML 4-era tables.
  • Now: deprecated — omit from new markup.
  • Replace a11y needs with scope and headers.
  • Replace script categories with data-* and updated JS.

One line: learn axis to read old tables — ship scope / headers (or data-*) instead.

Frequently Asked Questions

On td and th, it was meant to label cells with conceptual category names so user agents could group or query related cells. In practice, browsers rarely used it beyond exposing it in the DOM.
Yes. MDN lists axis as a deprecated attribute on both td and th. Do not use it in new HTML.
For header relationships, use scope on th and headers on cells that need explicit links. For custom categories in scripts, use data-* attributes and update any JavaScript that read axis.
HTML 4.01 described a comma-separated list of category names. MDN’s deprecated note describes space-separated strings. Either way, the attribute is obsolete — prefer scope and headers.
No reliable modern assistive-technology benefit. Use proper table structure with th, scope, and headers instead.
Usually the page still renders. The attribute is ignored for meaningful behavior. Clean it up when you modernize the markup.

Next: bgcolor

Another legacy presentational attribute — prefer CSS instead.

bgcolor tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful