HTML Headings are used to define titles and subtitles on a web page.
They help organize content and improve readability for both users and search engines.
In this tutorial, you will learn HTML heading tags, their importance, and see examples with output.
Table of Contents:
What Are HTML Headings
HTML headings are defined using <h1> to <h6> tags.
They are used to:
- Create titles and subtitles
- Structure content
- Improve SEO and readability
HTML Heading Tags List
There are six levels of headings in HTML.
Heading Tags Table
| Tag | Description |
|---|---|
<h1> | Main heading (largest) |
<h2> | Subheading |
<h3> | Section heading |
<h4> | Smaller heading |
<h5> | Smaller heading |
<h6> | Smallest heading |
HTML Headings Example
Example Code
<h1>Main Heading</h1>
<h2>Sub Heading</h2>
<h3>Section Heading</h3>
<h4>Small Heading</h4>
<h5>Smaller Heading</h5>
<h6>Smallest Heading</h6>
Output
Main Heading
Sub Heading
Section Heading
Small Heading
Smaller Heading
Smallest Heading
Explanation of Heading Sizes
<h1>is the largest and most important<h6>is the smallest and least important- Size decreases from h1 to h6
Importance of HTML Headings
Why Headings Matter
| Reason | Explanation |
|---|---|
| SEO | Search engines use headings to understand content |
| Structure | Organizes web pages |
| Readability | Makes content easy to scan |
| Accessibility | Helps screen readers |
HTML headings, h1 to h6 tags, HTML heading examples, HTML tutorial, learn HTML headings
Proper Use of Headings
Correct Example
<h1>Website Title</h1>
<h2>Section 1</h2>
<h3>Subsection</h3>
Output
Website Title
Section 1
Subsection
Incorrect Use of Headings
Example
<h1>Main Title</h1>
<h4>Wrong Order</h4>
Problem
- Skipping heading levels breaks structure
- Bad for SEO
Only One <h1> Per Page
Example
<h1>My Website</h1>
<h2>About Us</h2>
<h2>Services</h2>
Explanation
- Use only one
<h1>for main title - Use
<h2>to<h6>for subheadings
Styling Headings with Attributes
Example Code
<h1 style="color: blue;">Blue Heading</h1>
Output
Blue Heading (in blue color)
HTML Headings vs Paragraphs
Comparison Table
| Feature | Headings | Paragraph |
|---|---|---|
| Purpose | Titles | Text content |
| Tags | <h1> to <h6> | <p> |
| Importance | High | Normal |
Common Mistakes with Headings
| Mistake | Result |
|---|---|
Using multiple <h1> | Poor SEO |
| Skipping levels | Bad structure |
| Using headings for styling only | Wrong practice |
| Overusing headings | Cluttered content |
HTML Headings Example with Page Structure
Example Code
<h1>HTML Tutorial</h1>
<h2>Introduction</h2>
<p>This is the introduction section.</p><h2>Topics</h2>
<h3>HTML Basics</h3>
<p>Basic concepts of HTML.</p>
Output
HTML Tutorial
Introduction
This is the introduction section.
Topics
HTML Basics
Basic concepts of HTML.
You may like
Frequently Asked Questions (FAQ)
1. How many heading tags are there in HTML?
There are six heading tags from <h1> to <h6>.
2. Which heading is most important?
<h1> is the most important heading.
3. Can I use multiple <h1> tags?
It is not recommended for SEO.
4. Do headings affect SEO?
Yes, headings are very important for SEO.
5. Can I style headings?
Yes, using CSS or style attribute.