html tutorial - headers Attribute in HTML - html5 - html code - html form




Header attribute in html

Learn html - html tutorial - Header attribute in html - html examples - html programs

  • A table cell is related to one or more header cells which is specified by headers attribute.
  • The header attribute can be used to the elements are <td> and <th>.

Syntax for header attribute in HTML:

<td headers="header_id">

Applies to:

Attribute Elements Description
headers <td> It specifies a standard cell in an HTML table
headers <th> It specifies a header cell in an HTML table.

Sample coding header attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <style>
                    table, th, td {
                    border: 1px solid black;
                    }
        </style>
    </head>
    <body>
        <table style="width:100%">
            <tr>
                <th id="name">Name</th>
                <th id="email">Email</th>
                <th id="phone">Phone</th>
            </tr>
            <tr>
                <td headers="name">employee</td>
                <td headers="email">[email protected]</td>
                <td headers="phone">+12345678</td>
            </tr>
        </table>
    </body>
</html>

Code Explanation header attribute in HTML:

header Attribute Code Explanation

  1. In the header attribute, using the code table, td, th and its border alignments within the <style></style> tags in the head section.
  2. The <tr> tags are used to define a row and it contains one or more elements <td> or <th>.
  3. The <th> tags are used to define the header cell and it contain the header information within the <tr> tag; by default, the elements are bold and centered.
  4. The <td> tags are used to define the standard cell and it contains the data; by default, the elements are regular and left-aligned.

Output of header attribute in HTML:

header Attribute Output

  1. Here the output displays the table with 2 rows and 3 columns.

Browser Support of header attribute in HTML:

Element
<td> Yes Yes Yes Yes Yes
<th> Yes Yes Yes Yes Yes

Related Searches to headers Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×