The <header> tag
<header> marks the introductory content of its nearest sectioning ancestor — usually a logo, heading, and navigation.
Syntax
<header>...</header> Example
<header>
<img src="logo.svg" alt="Company name">
<nav>...</nav>
</header>
Notes
- header can be used multiple times on a page — once for the whole document, and again inside individual article/section elements.
- header has no fixed visual behavior by itself — it's semantics, not sticky positioning (see the sticky header snippet for that).
Accessibility
- header gets an implicit ARIA role of banner when it isn't nested inside article/aside/main/nav/section.
Related tools
The <nav> tag
Purpose of <nav>: grouping a page's primary navigation links.
The <footer> tag
Purpose of <footer>: closing content for a page or section (copyright, links, contacts).
Sticky header
A header that stays visible while the page scrolls: copy-ready HTML and CSS with position: sticky and top: 0, plus why sticky needs a scrolling parent.
Rebuild a page with semantic elements
Practice exercise: turn a page built from divs into semantic HTML with header, nav, main, article, section, aside and footer.