<header> Tag in HTML
The <header> tag is used to define a header for a document or a section in HTML. It typically contains introductory content, navigational links, or other important elements like logos or titles that are placed at the top of a page or section.
Key Points on <header> Tag:
- The <header> element is a structural element that groups content at the top of the page or section.
- It can contain elements like headings, paragraphs, images, or navigation links.
- The <header> tag is often used inside <body> or within other sectioning elements like <article>, <section>, and <footer>.
Syntax of <header> Tag:
Syntax Example
<header>
<h1>Welcome to My Website</h1>
<nav>... navigation links ...</nav>
</header>
Example of <header> Tag in HTML:
This example demonstrates how to use the <header> tag to create a webpage header with a title and navigation links.
Code Example
<header>
<h1>My Amazing Website</h1>
<nav>
<a href="#home">Home</a> |
<a href="#about">About</a> |
<a href="#services">Services</a> |
<a href="#contact">Contact</a>
</nav>
</header>
Output
My Amazing Website
The <header> tag is useful for grouping introductory content or navigation sections that are placed at the top of the page or a section of the document. It helps improve the structure and accessibility of your web pages.