Skip to content
Tutorials Center
My learning

Topics

HTML Reference Β· Sections

The <header> element

Reference for the HTML <header> element: site headers vs article headers, the banner landmark, header vs head, common mistakes, examples and technical details.

The <header> element holds introductory content for its nearest sectioning ancestor, or for the whole page. A site header usually contains the logo, the site name, the main navigation and a search box. An article header usually contains the title, author and date.

HTML
<header>
  <a href="/">Lantern Books</a>
  <nav aria-label="Main">…</nav>
</header>

Don't confuse it with <head>, which holds invisible metadata. <header> is visible page content inside the <body>.

Try it

A site header and an article header

Attributes

This element has no attributes of its own. It accepts the global attributes.

Usage notes

  • Page header = landmark. A header that is not inside an <article>, <aside>, <main>, <nav> or <section> is exposed as the banner landmark. Headers inside those elements are plain generic elements.
  • One site banner. Use a single page-level header; article and section headers can appear as often as you need.
  • Not required for every heading. A section with nothing but a heading doesn't need a header wrapper. Add one when there is more than the heading, such as a byline or a table of contents.
  • No nesting. A header may not contain a <footer> or another <header>.
  • Keep the main content out. The header introduces; the main text belongs in <main> after it.

Technical summary

Content categories Flow content, palpable content
Permitted content Flow content, but no <header> or <footer> descendants
Tag omission None; both the start and end tags are required
Permitted parents Any element that accepts flow content
Implicit ARIA role banner when scoped to the body; otherwise generic
DOM interface HTMLElement
Default display block

Browser support

Supported in every browser.