HTML <header> Tag

The <header> tag specifies a header section for a page or another container. This element is meant to have introductory content.




A page layout with <header>, <main>, and <footer> sections.

Page title
Header section.
Main section.
Footer section.
<!DOCTYPE html>
  <title>Page title</title>

  <header style="padding:30px;background:aliceblue;">
    Header section.

  <main style="padding:90px 30px;margin:30px 0;background:aliceblue;">
    Main section.

  <footer style="padding:30px;background:aliceblue;">
    Footer section.


Using <header>

The <header> element serves as a container for introductory content.

A <header> element may contain any of the following:

  • logo or icons
  • author information
  • search form
  • navigation links
  • and more..

A page can have multiple <header> elements located in different sections.

More Examples

A <header> inside an <article>.

Article header section

Paragraph 1

Paragraph 2

Paragraph 3

Article footer section
 <header style="padding:20px;background:aliceblue;">
   Article header section
 <p style="padding-left:30px;">Paragraph 1</p>
 <p style="padding-left:30px;">Paragraph 2</p>
 <p style="padding-left:30px;">Paragraph 3</p>

 <footer style="padding:20px;background:aliceblue;">
   Article footer section


Attributes for <header>

The <header> element has no attributes, but it does accept global attributes.
The following are commonly used.

Attribute Value Description
id    value Provides the header element with a unique identifier.
class    classnames Assigns one or more classnames to the header element.
style    CSS-values Assigns CSS style values to the header element.
data-*    value Defines additional data that can be used by JavaScript.
hidden    hidden Specifies whether the header element is hidden.

For additional global attributes see our global attributes list.

Layout Tags

The <header> tag is part of a group of semantic tags that help with creating the layout of web pages. This group is referred to as the Layout tag group. Together, these tags allow you to create comprehensive page layouts.

An example layout and a list of layout tags below.

HTML Layout
Element Description
<header> Defines a header section on a page or a section of a page
<main> Creates a container for the main content of the page
<footer> Defines a footer section on a page or a section of a page
<nav> Creates a container for navigation links
<aside> Creates a content area that is related to the primary content on a page
<article> Defines a container for independent and self contained text
<section> Defines a piece of content that can stand on its own
<div> Creates a division or section on a page

Note: Layout tags define areas on a page that contain content. By default they have no visual appearance, but are often styled, for example with a border or background color.

Browser support

Here is when <header> support started for each browser:

6.0 Sep 2010
4.0 Mar 2011
9.0 Mar 2011
11.1 Mar 2011
5.0 Jun 2010

You may also like