In web development, the header is a critical part of any webpage. It usually contains branding, navigation menus, logos, and sometimes call-to-action buttons. In HTML, the <header>
element is specifically designed for this purpose. In this post, we’ll walk you through how to create a header in HTML with examples and tips to make it SEO-friendly and responsive.
What is the <header>
Tag in HTML?
The <header>
tag defines a container for introductory content or a set of navigational links. It typically contains:
-
Logo or Site Name
-
Navigation bar (menu)
-
Tagline or Banner
-
Contact links or social icons
Basic HTML Header Structure Example:
Best Practices for Creating a Header in HTML:
-
Use
<header>
Only for Intro Sections:
Use it at the top of the page or inside articles and sections as needed. -
Keep Navigation Inside
<nav>
Tag:
The menu should be semantically marked with<nav>
for accessibility and SEO. -
Add ALT Text to Logo Images:
Helps with screen readers and image SEO. -
Make it Responsive:
Use CSS media queries to adapt the header to mobile screens. -
Include Meta Tags for SEO:
Add meta tags in<head>
for proper indexing.
Advanced Example with Logo and Button:

SEO Benefits of a Well-Structured Header
-
Helps search engines understand your website layout.
-
Boosts user experience with easy navigation.
-
Enhances site accessibility for all users.
Creating a header in HTML is simple yet powerful. By using semantic elements like <header>
and <nav>
, and combining them with responsive CSS and SEO techniques, you build a professional and accessible user experience.