HTML - attributes - headers

revision:


Content

"headers" attribute: specifies header cells in a table syntax some examples


"headers" attribute: specifies header cells in a table

top

It specifies one or more header cells a table cell is related to. The headers attribute can be used on the <td> and <th> elements.


syntax

top

<th headers="header_id "></th>

<td headers="header_id "></td>

header_id specifies a space-separated list of id's to one or more header cells the table cell is related to.


some examples

top
Name Email Phone Address
John Doe [email protected] +45342323 Rosevn 56,4300 Sandnes,Norway
codes:
                    <table style="margin-left:3vw;" style="width:100%">
                        <tr>
                        <th id="name">Name</th>
                        <th id="email">Email</th>
                        <th id="phone">Phone</th>
                        <th id="addr">Address</th>
                        </tr>
                        <tr>
                        <td headers="name">John Doe</td>
                        <td headers="email">[email protected]</td>
                        <td headers="phone">+45342323</td>
                        <td headers="addr">Rosevn 56,4300 Sandnes,Norway</td>
                        </tr>
                    </table>
                
Name
Firstname Lastname
codes:
                    <table style="margin-left:3vw;">
                        <tr>
                        <th id="name" colspan="2">Name</th>
                        </tr>
                        <tr>
                        <th headers="name">Firstname</th>
                        <th headers="name">Lastname</th>
                        </tr>
                    </table>