<header> Tag in HTML

Quick facts

CategoryFlow content, palpable content
Content modelFlow content, but no nested <header> or <footer> elements
Tag omissionNeither the start nor end tag can be omitted
Permitted parentsAny element that accepts flow content, but not a descendant of <address>, <header>, or <footer>
DOM interfaceHTMLElement

Syntax

<header> ... </header>

Live example

Edit the code below and watch the preview update instantly.

index.html
Preview

Attributes

AttributeDescription
—<header> has no attributes of its own — only the global attributes shared by every HTML element.

Common examples

A site header with logo and menu

The most common use: the logo linking home, plus the main <nav>.

<header class="site-header"> <a href="/" class="logo"><img src="logo.svg" alt="Acme home" width="120" height="32"></a> <nav aria-label="Main">…</nav> </header> <style> .site-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; } </style>

An article header

Articles can have their own header holding the title, author and date.

<article> <header> <h2>10 HTML tips for beginners</h2> <p>By Jane Doe · <time datetime="2026-10-03">October 3, 2026</time></p> </header> <p>Article text…</p> </article>

A sticky header

Keep the header visible while scrolling with position: sticky. Give it a background so content doesn’t show through.

<style> .site-header { position: sticky; top: 0; z-index: 10; background: #fff; } </style>

A header with a search box

Site-wide search often lives in the header. Use a search form with a label (it can be visually hidden) so it’s accessible.

<header> <a href="/">Acme</a> <form role="search" action="/search"> <label for="q" class="visually-hidden">Search</label> <input type="search" id="q" name="q" placeholder="Search…"> </form> </header>

<header> vs <nav>

A <header> is the introductory area of a page or section: it can hold a logo, a title, a search box, a tagline and the navigation. A <nav> is specifically a block of navigation links.

That’s why the nav usually lives inside the header. Use the header for the whole top bar, and nav for just the menu within it. Pages can also have a nav outside the header, such as a sidebar menu or breadcrumbs.

<header><nav>
PurposeIntroductory contentNavigation links
Can containLogo, title, search, navMostly links
Typical placeTop of page or articleInside the header, sidebar

Common mistakes to avoid

  • Confusing <header> with <head>. The <head> holds invisible page information; the <header> is visible content.
  • Nesting a header inside a <footer> or another <header>. That isn’t allowed; use a div if you need an extra wrapper.
  • Wrapping every heading in a header. A lone <h2> doesn’t need one; use a header when there’s a group of introductory content.
  • A sticky header that eats the screen. On phones, a tall fixed header can cover half the content; keep it slim.

Accessibility & SEO tips

  • The page-level header becomes the “banner” landmark, so screen reader users can jump to it. Headers inside articles or sections don’t.
  • Give the logo link meaningful alt text such as “Acme home” so it makes sense when read aloud.
  • Keep important text (like the page’s <h1>) as real text, not part of an image, so search engines can read it.

Browser support

Supported in all modern browsers, including Chrome, Edge, Firefox, Safari and their mobile versions. It was introduced with HTML5, and only very old browsers such as Internet Explorer 8 needed workarounds.

Related tags

Frequently asked questions

Is there only one <header> per page?
No — you can have a page-level <header> and additional <header>s inside individual <article> or <section> elements.
Is <header> the same as the HTML <head>?
No — <head> holds document metadata (title, meta tags, links) and isn't visible. <header> is a visible, semantic content region inside <body>.
How do I make a sticky header?
Add position: sticky; top: 0; to the header in CSS, plus a background color and a z-index so it stays above the content as the page scrolls.
Can a <header> contain an <h1>?
Yes. The page header often contains the site name or the page's main heading in an <h1>, and article headers usually contain the article's title.
Does every <article> need a <header>?
No. It's optional. Add one when the article has introductory content to group, such as a title together with an author and date.
What is the difference between <header> and <h1>?
An <h1> is a single heading. A <header> is a container for introductory content, which may include that <h1> plus a logo, navigation or a short description. A page usually has its <h1> inside the main <header> or at the top of <main>.