The h1
tag defines the most important heading on a webpage. It is typically used for:
- The main title of the page
- Important sections that require top-level emphasis
- Improving accessibility and SEO
✅ Basic Syntax
<h1>Welcome to My Website</h1>
📍 Result:
Displays large, bold text by default — usually used as the top heading on a page.
📚 Heading Levels
HTML offers six levels of headings:
<h1>Most important</h1>
<h2>Subsection</h2>
<h3>Sub-subsection</h3>
<h4>Minor heading</h4>
<h5>Smaller heading</h5>
<h6>Least important</h6>
<h1>
should typically appear once per page to represent the main title.- Use
<h2>
to<h6>
for nested content.
🎯 Semantic Meaning
The <h1>
tag has semantic value — it tells search engines and screen readers that the content is a main title or key topic.
💡 Proper heading structure helps:
- Screen readers navigate your content
- Search engines understand page hierarchy
- Users scan pages more effectively
🎨 CSS Styling Example
<style>
h1 {
font-size: 2.5rem;
color: #2c3e50;
text-align: center;
margin-top: 40px;
}
</style>
⚠️ Best Practices
✅ Do | ❌ Avoid |
---|---|
Use only one <h1> per page | Using <h1> for every heading |
Follow a logical heading structure | Skipping heading levels (h1 → h4 ) |
Make it descriptive (e.g., blog title) | Using generic headings like “Home” |
✅ Summary
Feature | <h1> Tag |
---|---|
Purpose | Defines the main heading |
Importance | Highest level of heading |
SEO Value | ✅ Yes — very important |
Appearance | Large, bold (can be styled with CSS) |
Use per Page | Typically 1 for best semantic structure |