<header> Tag Examples

Examples of the header tag in HTML 5

Header for the body of a page:

<html>
   <head>
      <title>Page Title</title>
   </head>
   <body>
      <header>
         <h1>Page Title</h1>
      </header>
      ...
   </body>
</html>

It is common to use the same Page Title for both the <title> tag and the first heading <h1> tag.

Header for a subsection of a page:

<section>
   <header>
      <h2>Subsection Title</h2>
   </header>
   ...
</section>

Section header with multiple heading lines:

<section>
   <header>
      <hgroup>
         <h2>Section Title</h2>
         <h3>Section Subtitle</h3>
      </hgroup>
   </header>
   ...
</section>

The <hgroup> tag associates the <h3> heading with the <h2> section rather than starting a new implied subsection.