html
  1. html-header-tag

HTML <header> Tag

The HTML <header> tag represents a container for introductory content or a set of navigational links.

Syntax

The syntax for the <header> tag is as follows:

<header>
  <!-- content goes here -->
</header>

Example

Here's an example of how to use the <header> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Page Title</title>
  </head>
  <body>
    <header>
      <h1>Addtionalsheet</h1>
      <nav>
        <ul>
          <li><a href="#">Home</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact</a></li>
        </ul>
      </nav>
    </header>
    <main>
      <h2>Welcome to addtionalsheet!</h2>
      <p>This is the home page of my addtionalsheet.</p>
    </main>
  </body>
</html>
Try Playground

The <header> tag will create a container for the content within and render it like this:

Explanation

The <header> tag is used to provide introductory content or a set of navigational links at the top of a web page. It is usually placed within the <body> element.

In the example above, the <header> tag contains a <h1> tag that displays the website name, and a <nav> tag that contains an unordered list of links to other pages on the website.

Use

The <header> tag is used to create a container for introductory content or a set of navigational links on a web page.

Some possible use cases for the <header> tag are:

  • Displaying the name and logo of the website
  • Providing navigation links to other pages on the website
  • Displaying a search bar
  • Displaying social media links

Important Points

  • The <header> tag should be used only once per web page.
  • The <header> tag is commonly used in conjunction with the <nav> tag, which contains a list of links to other pages on the website.
  • The <header> tag is usually placed at the top of the <body> element.

Summary

The <header> tag is used to create a container for introductory content or a set of navigational links on a web page. It should be used only once per web page and is commonly used with the <nav> tag.

Published on: