You are here: Reference > HTML > attributes > headers (td, th)

headers attribute (td, th)

Browser support:
Sets a list of header cells that provide header information for the current data cell.
The functionality of this attribute is not implemented in browsers. It is typically used by applications that attach header information to data cells like non-visual media (speech). The ids specified by the value of the headers attribute identify the header elements that belong to the current cell.
In the example below, the headers attached to the cell (12.74) are: 'Alabama' (id=loc1), '12-aug-05' (id=dat1), and 'Apple' (id=col1).
JavaScript page for this attribute: headers. You can find other example(s) there.

Possible values:

String that sets a space-separated list of header cell identifiers.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the headers attribute:
<table border="1px" id="myTable" summary="This table summarizes fruit costs in august.">
    <caption>Fruits Cost Report</caption>
    <tr>
        <th></th>
        <th id="col1" axis="fruits">Apple</th>
        <th id="col2" axis="fruits">Pear</th>
        <th id="col3" axis="fruits">Peach</th>
    </tr>
    <tr>
        <th id="loc1" axis="location">Alabama</th>
        <th colspan="3"></th>
    </tr>
    <tr>
        <td id="dat1" axis="date">12-aug-05</td>
        <td headers="loc1 dat1 col1">12.74</td>
        <td headers="loc1 dat1 col2">54.00</td>
        <td headers="loc1 dat1 col3">45.00</td>
    </tr>
</table>
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content