HTML Headings <h1> β <h6> β Structuring Content
π Introduction
HTML provides 6 levels of headings, from <h1> (most important) to <h6> (least important).
Headings are used to structure content and make it easier to read for both users and search engines.
π§± Syntax
<h1>Main Title</h1>
<h2>Section Title</h2>
<h3>Subsection Title</h3>
<h4>Smaller Section</h4>
<h5>Minor Heading</h5>
<h6>Smallest Heading</h6>
π‘ Example
<!DOCTYPE html>
<html>
<head>
<title>Headings Example</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<h2>About Me</h2>
<h3>My Skills</h3>
<h4>HTML</h4>
<h4>CSS</h4>
</body>
</html>
π₯οΈ Output Explanation
The browser displays headings in different sizes:
<h1>β biggest and most important<h2>β slightly smaller<h3>β smaller- ...
<h6>β smallest
π― Why Headings are Important
1. π Content Structure
Headings organize your page like a book:
- Title β chapters β sections β sub-sections
2. π SEO (Search Engines)
Search engines use headings to understand:
- What your page is about
- Which content is most important
β <h1> should represent the main topic of the page
3. π Readability
Good headings make content:
- Easier to scan
- More user-friendly
- Better organized
β οΈ Best Practices
Use only one
<h1>per page (recommended)Follow proper order:
<h1>β<h2>β<h3>(donβt skip levels randomly)
Donβt use headings just to make text bigger
Use headings for structure, not styling
π« Common Mistakes
- Using multiple
<h1>tags everywhere β - Skipping levels (e.g.
<h1>β<h4>) β - Using headings for design instead of structure β
π§ͺ Mini Exercise
Create a page about yourself:
Add a main title using
<h1>Add sections using
<h2>:- About me
- Skills
- Goals
Add at least 2 subheadings using
<h3>