মূল বিষয়বস্তুতে যান

html tag for header: How to Use the HTML Element

LinkinTech SEO Editorial Team· Editorial Team· 10 min read
html tag for header: How to Use the HTML Element

Quick Answer

The html tag for header is <header>. It identifies introductory or navigational content for a webpage or a specific section. Its basic syntax is <header>...</header>. Use it for content such as a website name, introductory heading, logo, author details, or navigation. It belongs inside <body> or an appropriate content section, not inside <head>.

Key Takeaways

  • Use <header> for introductory or navigational content, not for document metadata.
  • A page-level header commonly contains the website identity and main navigation.
  • An <article> can have its own header introducing that article.
  • <header>, <head>, and <h1> have different semantic purposes.
  • A page-level header can create an accessibility banner landmark; a nested section header does not automatically do so.
  • CSS controls the header's visual appearance, while HTML communicates its meaning.
  • A <header> cannot be nested inside another <header>, <footer>, or <address> element.

What Is the HTML Header Element?

The HTML <header> element represents a group of introductory or navigational content. The WHATWG HTML Living Standard defines its role in organizing the introduction to a page or section.

A header commonly contains one or more of the following:

  • A website name or logo.
  • An introductory heading.
  • Main navigation links.
  • Author or publication information.
  • A search form.
  • Other introductory content relevant to the section.

For example:

<header>
  <h1>Example Website</h1>
  <nav aria-label="Main navigation">
    <a href="/">Home</a>
    <a href="/about">About</a>
    <a href="/contact">Contact</a>
  </nav>
</header>

This example uses <header> to group the site's introductory content and navigation. The <h1> identifies the main heading, while <nav> identifies the navigation area.

A heading is common inside a header, but it is not mandatory. The element's purpose is to group introductory or navigational content, not simply to hold a heading.

Is the Header Tag a Semantic HTML Element?

Yes. <header> is a semantic HTML element. Semantic elements describe the purpose of content rather than only how it looks.

For example, a browser can display two identical-looking containers, but their HTML meaning can differ:

<div class="site-header">
  <h1>Example Website</h1>
</div>
<header>
  <h1>Example Website</h1>
</header>

The first uses a generic <div>. The second communicates that the content is an introduction or navigation group. CSS can make either container look the same, but the semantic meaning is different.

How to Use a Header Tag in a Complete HTML Page

A page-level <header> usually appears inside the document's <body> element. It introduces the website or page before the main content.

Here is a minimal complete example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Example Website</title>
</head>
<body>
  <header>
    <h1>Example Website</h1>
    <nav aria-label="Main navigation">
      <a href="/">Home</a>
      <a href="/about">About</a>
    </nav>
  </header>

  <main>
    <h2>Welcome</h2>
    <p>This is the main content of the example page.</p>
  </main>
</body>
</html>

Notice the document structure:

  1. <!DOCTYPE html> declares an HTML document.
  2. <html lang="en"> identifies the document language.
  3. <head> contains metadata, the page title, and other document-level information.
  4. <body> contains the content displayed as part of the page.
  5. <header> introduces the website and its navigation.
  6. <main> contains the primary content of the page.

The header is not a replacement for <body> or <main>. It is a distinct semantic section that can introduce the content that follows.

How to Use a Header Inside an Article or Section

A header does not have to introduce the entire website. It can also introduce an individual article or another section of content.

For example, a blog article might use its own header for the article title and publication date:

<article>
  <header>
    <h2>Understanding Semantic HTML</h2>
    <p>Published November 18, 2026</p>
  </header>

  <p>Semantic HTML helps browsers and assistive technologies understand page structure.</p>
</article>

Here, the <header> introduces the article rather than the entire website. The <h2> identifies the article heading in this example, and the paragraph provides publication information.

You can use multiple <header> elements in one document when they introduce different parts of the content. For example, a page may have one site-level header and separate headers inside individual articles.

The important rule is that each header should have a meaningful structural purpose. Do not add one to every container simply because you want to apply a particular style.

Header vs. Head vs. H1: What Is the Difference?

These three HTML elements are easy to confuse because their names and common uses are related. However, they perform different jobs.

Element Main purpose Typical location
<header> Groups introductory or navigational content Inside <body> or section content
<head> Holds document metadata and resource references Direct child of <html>
<h1> Identifies a top-level content heading Within the document's body content
<h2>–<h6> Identify lower-level headings Within the relevant content sections

What Does the <header> Tag Do?

<header> groups introductory or navigational material. It can contain a heading, logo, navigation, author details, or other relevant introductory content.

It does not define the document's metadata or automatically create a heading. Its meaning comes from the content and structural context in which it appears.

What Does the <head> Tag Do?

<head> contains information about the HTML document that is generally not displayed as the main page content.

Examples include:

  • The document title using <title>.
  • Character encoding information using <meta>.
  • Responsive viewport settings.
  • Stylesheet references using <link>.
  • Other document metadata and resource references.

For example:

<head>
  <meta charset="UTF-8">
  <title>My Website</title>
  <link rel="stylesheet" href="styles.css">
</head>

There is one <head> element in a standard HTML document. It is not the visible website header. See the MDN reference for the HTML head element for its document-metadata role.

What Does the <h1> Tag Do?

<h1> identifies a top-level heading in the content. It tells readers and assistive technologies what the main heading represents.

For example:

<header>
  <h1>My Website</h1>
  <nav aria-label="Main navigation">
    <a href="/">Home</a>
  </nav>
</header>

In this example, <header> groups the introductory content, while <h1> supplies the heading itself. They work together but are not interchangeable.

For a broader reference to HTML structural and heading elements, see MDN's HTML elements reference.

Does the Header Element Create an Accessibility Landmark?

Sometimes. The accessibility meaning of <header> depends on where it appears in the document.

A page-level <header> in the body context generally creates an implied banner landmark. A banner landmark identifies the introductory area for the overall website or page. Screen-reader users can use landmarks to move between important page regions.

However, a <header> inside an <article>, <main>, <nav>, <section>, or <aside> does not automatically become the page-wide banner landmark. In those contexts, it introduces the relevant section or content area.

Use this practical decision rule:

Header placement Expected meaning
Page-level header in the body context Site-wide introductory content and banner landmark
Header inside an article Introduction to that article
Header inside a section Introduction to that section
Header inside an aside Introduction to the complementary content

The MDN header element reference explains this contextual behavior. The W3C ARIA Authoring Practices Guide explains how landmarks help users understand and navigate page organization.

A page should generally have one banner landmark. Avoid creating several page-wide banner regions without a clear structural reason. If a design genuinely requires multiple relevant landmarks, ensure their identification is meaningful and understandable.

Should You Add role="banner" to a Header?

Usually, no. Native HTML semantics already provide the appropriate implied banner landmark when a <header> appears in the correct page-level context.

For example, this is normally sufficient:

<body>
  <header>
    <h1>Example Website</h1>
  </header>
</body>

Adding role="banner" unnecessarily duplicates the meaning already provided by the native element. Prefer semantic HTML first, and use explicit ARIA roles only when there is a genuine accessibility requirement that native HTML does not meet.

Common HTML Header Mistakes to Avoid

Small structural mistakes can make HTML harder to understand and maintain. Watch for these common problems.

1. Confusing <header> with <head>

These elements are not interchangeable. <head> contains document metadata, while <header> introduces visible page or section content.

Put the page title and stylesheet references in <head>. Put the website identity, introductory heading, and navigation in an appropriate <header> inside the body.

2. Using <header> Only to Position Content at the Top

The element is not a CSS positioning command. If a container only groups content for styling and has no introductory or navigational purpose, a <div> may be more appropriate.

Use CSS to position or style the header rather than choosing an HTML element based only on its appearance.

3. Nesting One Header Inside Another

The WHATWG HTML standard does not permit a <header> element to be a descendant of another <header> element.

This structure is incorrect:

<header>
  <h1>Example Website</h1>
  <header>
    <h2>Section Introduction</h2>
  </header>
</header>

Instead, use an appropriate sectioning element when you need a separate content area:

<header>
  <h1>Example Website</h1>
</header>

<section>
  <header>
    <h2>Section Introduction</h2>
  </header>
  <p>Section content goes here.</p>
</section>

A header also cannot be a descendant of an <address> or <footer> element under the HTML content-model rules.

4. Forgetting the Closing Tag

Both the opening and closing tags are required:

<header>
  <h1>Example Website</h1>
</header>

Do not omit </header> and rely on the browser to repair the markup.

5. Using Heading Tags Only for Their Font Size

A heading element communicates document structure. It should not be selected simply because its default appearance is large or bold.

Use CSS to adjust font size, weight, and spacing. Choose <h1> through <h6> according to the actual heading hierarchy.

6. Assuming Every Header Is a Banner Landmark

A header inside an article is not the same as the page-wide banner. Its semantic context determines its accessibility behavior.

Check the placement of the element rather than assuming every <header> creates a banner landmark.

How to Check Whether Your HTML Header Is Correct

After adding a header, review the HTML structure and its accessibility behavior. A quick inspection can catch most beginner mistakes.

Use this checklist:

  1. Check the element name: Confirm that the opening tag is <header> and the closing tag is </header>.
  2. Check its purpose: Make sure it groups introductory or navigational content.
  3. Check its placement: Confirm that it is inside <body> or an appropriate section of body content, rather than inside <head>.
  4. Check nesting: Ensure it is not a descendant of another <header>, <footer>, or <address> element.
  5. Check headings: Use heading elements for actual headings, not as styling shortcuts.
  6. Check navigation: If the header contains navigation, identify it with a <nav> element where appropriate.
  7. Check accessibility: Inspect the accessibility tree or use assistive-technology testing to confirm that the expected landmarks are exposed.
  8. Check visual styling separately: Use CSS to control colors, spacing, alignment, and responsive behavior.

You can inspect the page's HTML in your browser's developer tools. For accessibility checks, examine the accessibility tree and confirm whether the page-level banner and other landmarks appear as expected.

If you are conducting a broader website review, the site's SEO content audit guide provides a related process for reviewing content and on-page elements. Semantic HTML checks are one part of a wider review, not a substitute for checking the page's content and technical health.

Does Using the Header Tag Improve SEO?

Using <header> correctly helps communicate the structure and purpose of page content. It can also support accessibility and make HTML easier for developers to maintain.

However, adding a <header> element by itself does not guarantee better Google rankings, faster indexing, or increased organic traffic. It should be used because it accurately describes the content, not as a ranking shortcut.

For SEO, focus on the overall quality and usefulness of the page, meaningful headings, accessible navigation, crawlable links, and technically sound HTML. Semantic markup supports a well-structured page, but it cannot replace valuable content or sound technical implementation.

Frequently Asked Questions

What Is the HTML Tag for a Header?

The HTML tag for a header is <header>. It groups introductory or navigational content for a webpage or a particular section, such as a website name, heading, logo, or navigation links.

Where Should the Header Tag Go in HTML?

A page-level <header> normally goes inside <body>. You can also place a header inside an <article> or another appropriate section when it introduces that content.

Can a Website Have More Than One Header Tag?

Yes. A document can contain multiple <header> elements when they introduce different parts of the page. For example, the website may have a page-level header while individual articles have their own headers. Do not nest one header inside another.

Is Header the Same as H1?

No. <header> groups introductory or navigational content. <h1> identifies a top-level heading. A header can contain an <h1>, but the two elements serve different purposes.

Is Header the Same as Head in HTML?

No. <head> contains document metadata, such as the title, character encoding, and stylesheet references. <header> represents introductory or navigational content within the body.

Does Every Header Create a Banner Landmark?

No. A page-level header in the body context generally creates an implied banner landmark. A header nested within an article, main, nav, section, or aside does not automatically create the page-wide banner landmark.

Can I Use a Div Instead of a Header?

Yes, if the container has no meaningful introductory or navigational role. Use <header> when its semantic purpose fits the content. Use <div> for a generic container that exists primarily for grouping or styling.

Do I Need CSS for the Header Tag?

No. <header> works as HTML without custom CSS. CSS is optional and controls how the element looks, including its background, spacing, positioning, and responsive layout.

Final Thoughts

The correct HTML tag for a header is <header>, but using it properly involves more than placing a container at the top of a page. It should group introductory or navigational content and appear in the right structural context. A page-level header can provide the banner landmark, while an article-level header introduces only that article.

Keep it distinct from <head> and <h1>, use CSS for visual styling, and follow the HTML nesting rules. This creates clearer, more accessible markup without relying on unsupported SEO promises.