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.
<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
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 thebannerlandmark. Headers inside those elements are plaingenericelements. - 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.
Related
<footer>β closing information<nav>β navigation links, often inside the header<h1>β<h6>β headings<head>β document metadata (not the same thing)- Lessons: Semantic Elements, Page Layout, Building Navigation Menus