HTML <td> headers Attribute

The headers attribute on a <td> tag points to one or more table header cells which the data cell is related to.

The headers setting has no visual effect.



A headers attribute on <td> elements.
Each data cell references its corresponding table header.

Name Country
Christina Berglund Sweden
Maria Larsson Sweden
  table.tb { width: 300px; border-collapse: collapse; }
  .tb th { background-color:lightblue; }
  .tb th, .tb td { border: solid 1px #777; padding: 5px; }

<table class="tb">
      <th id="name" colspan="2">Name</th>
      <th id="country">Country</th>
      <td headers="name">Christina</td>
      <td headers="name">Berglund</td>
      <td headers="country">Sweden</td>
      <td headers="name">Maria</td>
      <td headers="name">Larsson</td>
      <td headers="country">Sweden</td>

Using headers

The headers> attribute specifies which table header cells are related to the current data cell.

This attribute accepts a space-separated string of table header ids.

The headers setting has no visual effect. It is used by screen readers, search engines, JavaScript, etc.


<td headers="header-id">



Value Description
header-ids Space-separated string of table header ids.

Browser support

Here is when headers support started for each browser:

1.0 Sep 2008
1.0 Sep 2002
1.0 Aug 1995
1.0 Jan 2006
1.0 Jan 2003

You may also like

 Back to <td>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023

Quick question: what's your favorite/least favorite part of Dofactory?