The HTML <header> tag represents the introductory content or the heading section at the top of a web page or a specific section within the page. It's typically used to contain elements that provide a contextual introduction to the main content of the page, such as logos, navigation menus, site titles, and other relevant content.
HTML Header tag
Here's an example of how the <header> tag can be used in an HTML document:
<!DOCTYPE html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<header>
<!-- Header content here including h1 heading title -->
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<!-- Main content of the page -->
</main>
<footer>
<!-- Footer content here -->
</footer>
</body>
</html>
In this example, the <header> element contains the site title and a navigation menu. The content within the <header> tag is considered introductory and is often displayed prominently at the top of the page, helping users navigate the site and understand its purpose.
Using the <header> tag enhances the semantic structure of the page and makes it easier for both human readers and search engines to identify and understand the important introductory content of the webpage.
×