Open In App

HTML <td> headers Attribute

Last Updated : 11 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML <td> headers attribute specifies the header cells related to a table cell, aiding accessibility for screen readers without visual impact in web browsers.

Syntax

<td headers="header_id">

Attribute Valuescells

Name

Description

header_id

specify the space to the separated list of id to one or more Header cells that the table data cell is related to. 

HTML <td> headers attribute Example

Example: In this example we demonstrates the usage of the <td> headers attribute for associating data cells with header cells in a table, enhancing accessibility and aiding screen readers in interpreting tabular data.

html




<!DOCTYPE html>
<html>
    <head>
        <style>
            table,
            th,
            td {
                border: 1px solid green;
            }
        </style>
    </head>
 
    <body>
        <h2>
            HTML <td> Headers Attributes
        </h2>
 
        <table>
            <tr>
                <th id="name">Name</th>
                <th id="father">Father's Name</th>
                <th id="mother">Mother's Name</th>
                <th id="phone">Phone No.</th>
            </tr>
            <tr>
                <td headers="name">Krishna</td>
                <td headers="father">
                    Manoj Gupta
                </td>
                <td headers="mother">
                    Manisha Gupta
                </td>
                <td headers="phone">12345</td>
            </tr>
        </table>
        <br />
    </body>
</html>


Output:

HTML <td> headers Attribute example output Supported Browsers:

The browsers supported by HTML <td> headers Attribute are listed below:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads