HTML5 - Header




HTML5 Header

HTML5 <header> element is for the page header which might contain a logo, navigation and any other consistent elements that might be considered the page header. The <header> tag is new in HTML5. The <header> tag specifies an introduction, or a group of navigation elements for the document. The <header> tag is supported in all major browsers.

Syntax

<header>...</header>
HTML5 <header> element is for the page header which might contain a logo.
<header>
<a href="/" class="logo"><img src="logo/site_logo.jpg" alt="MCN logo"></a>
</header>

Attributes

HTML tags can contain one or more attributes. Attributes are added to a tag to provide the browser with more information about how the tag should appear or behave. Attributes consist of a name and a value separated by an equals (=) sign, with the value surrounded by double quotes.

There are 3 kinds of attributes that you can add to your HTML tags: Element-specific, global, and event handler content attributes. The attributes that you can add to this tag are listed below.

The Element Specific Attributes

The following table shows the attributes that are specific to this tag/element.

For Example
Attributes Introduced by HTML5
Attributes Description
None

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example of HTML5 header element</title>
<meta name="description" content="This is an example of HTML5 header element. header element is the head of a new section." />
</head>
<body>
<header>
<h1>Example of HTML5 header element</h1>
<p>header element is the head of a new section.
It may contain : </p>
<ul>
<li>h1-h6</li>
<li>hggroup</li>
<li>Table of content</li>
<li>Search Form</li>
<li>Logos</li>
</ul>
</header>
</body>
</html>

Result

Example of HTML5 header element

Example of HTML5 header element

header element is the head of a new section. It may contain :

  • h1-h6
  • hggroup
  • Table of content
  • Search Form
  • Logos