

- 1HTML Forms
- 2HTML form Tag
- 3HTML Input Types
- 4HTML Labels and Placeholders
- 5HTML Select Dropdown
- 6HTML Checkbox
- 7HTML Radio Buttons
- 8HTML Textarea
- 9HTML Submit and Reset Buttons
- 10HTML Form Validation
- 11HTML Required Fields
- 12HTML Input Pattern Attribute
- 13HTML min and max Attribute
- 14HTML Form Action and Method
- 15HTML Fieldset and Legend
- 16HTML Form Advanced Controls
- 17HTML Date Picker
- 18HTML Range Slider
- 19HTML Color Picker
- 20HTML File Upload
- 21HTML Datalist
- 22HTML Autofocus and Autocomplete




- 1Accessibility in HTML
- 2Alt Text for Images
- 3ARIA Roles in HTML
- 4Semantic HTML for Accessibility
- 5Keyboard Navigation in HTML
- 6Screen Reader Accessibility in HTML
- 7HTML Best Practices for SEO
- 8HTML Meta Tags
- 9HTML Headings Best Practices
- 10Title and Meta Description Tags in HTML
- 11HTML Linking Structure
- 12HTML Clean Code Standards

header Element in HTML
Semantic Tag with Examples
HTML <header>
Element: Introductions With Meaning
Every story has a beginning — and in HTML, that beginning often lives in a <header>
. This semantic element represents the introductory content of a page or a section. It's not just about visual design — it's about giving structure and meaning to where things begin.
Purpose of <header>
The <header>
element is used to group introductory content — like titles, logos, navigation, and brief summaries. It can be used once at the top of the page or within individual sections or articles.
Think of it as the handshake of your content.
Basic Syntax
<header>
<h1>Fruit Blog</h1>
<nav>
<a href="#apple">Apple</a>
<a href="#banana">Banana</a>
</nav>
</header>
Fruit Blog
[ Apple | Banana ]
This header introduces the page and includes navigation for fruit-related topics.
Where Can You Use <header>
?
- At the top of the entire document — introducing the whole page
- Inside
<article>
or<section>
— as a local heading
Example: Section with Header
<section>
<header>
<h2>Cherry Facts</h2>
<p>Everything you need to know about cherries.</p>
</header>
<p>Cherries are small, round, and rich in antioxidants...</p>
</section>
This use clearly introduces the section without affecting the main page header.
Difference Between <header>
and <head>
These two are often confused. Here’s a quick distinction:
| Element | Purpose | |---------------|---------------------------------------| |<head>
| Contains metadata, links, scripts |
| <header>
| Contains visible page/section intro |
Accessibility and Semantics
<header>
helps screen readers and assistive technologies understand the structure of your content. It improves navigability for users with disabilities by grouping related introductory content.
Best Practices:
- Use only one
<header>
per section - Include
<h1>
to<h6>
inside headers to clarify hierarchy - Avoid placing
<header>
inside a<footer>
or<address>
Real-World Example: Full Page with <header>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fruit World</title>
</head>
<body>
<header>
<h1>Welcome to Fruit World</h1>
<nav>
<a href="#apple">Apple</a> |
<a href="#banana">Banana</a> |
<a href="#cherry">Cherry</a>
</nav>
</header>
<main>
<section id="apple">
<header>
<h2>Apple Section</h2>
</header>
<p>Apples are crispy and sweet.</p>
</section>
</main>
</body>
</html>
Welcome to Fruit World
[ Apple | Banana | Cherry ]
Apple Section
Apples are crispy and sweet.
Summary
The <header>
element creates a meaningful introduction for content. You’ve learned how to:
- Use
<header>
for pages, articles, and sections - Include navigation and headline content
- Improve accessibility and content clarity
What’s Next?
Up next: we’ll explore the <footer>
element — the closing act that wraps up content meaningfully and semantically.