totn HTML

HTML: <header> tag

This HTML tutorial explains how to use the HTML element called the <header> tag with syntax and examples.

Description

The HTML <header> tag is an HTML5 element that defines a header usually containing logo, search form and introductory information in the HTML document. This tag is also commonly referred to as the <header> element.

Syntax

In HTML, the syntax for the <header> tag is:

<body>
<header>
  <img src="logo.png" alt="Logo">
</header>
</body>

Attributes

Only the Global Attributes apply to the <header> tag. There are no attributes that are specific to the <header> tag.

Note

Browser Compatibility

The <header> tag has basic support with the following browsers:

  • Chrome 5+
  • Android 2.2+
  • Firefox 4.0+ (Gecko 2.0+)
  • Firefox Mobile 4.0+ (Gecko 2.0+)
  • Internet Explorer 9.0+ (IE 9.0+)
  • IE Phone 9.0+
  • Opera 11.10+
  • Opera Mobile 11.0+
  • Safari 4.1+ (WebKit)
  • Safari Mobile 5.0+ (iOs 4.2+)

Example

We will discuss the <header> tag below, exploring examples of how to use the <header> tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.