how to write HTML Headings
how to write HTML Headings
Complete guide to using HTML heading tags (H1 to H6) effectively
Introduction to HTML Headings
HTML headings are titles or subtitles that you want to display on a webpage. They are defined with the <h1> to <h6> tags, where <h1> defines the most important heading and <h6> defines the least important heading.
This is a Heading 1
This is a Heading 2
This is a Heading 3
This is a Heading 4
This is a Heading 5
This is a Heading 6
HTML Heading Tags
Basic Heading Structure
<h1>Main Title of the Page</h1>
<h2>Section Heading</h2>
<h3>Subsection Heading</h3>
<h4>Minor Heading</h4>
<h5>Small Heading</h5>
<h6>Least Important Heading</h6>
Heading Hierarchy and Default Sizes
| Tag | Importance | Default Font Size | Usage |
|---|---|---|---|
| <h1> | Highest | 2em (32px) | Main page title (use only once per page) |
| <h2> | High | 1.5em (24px) | Major section headings |
| <h3> | Medium | 1.17em (18.72px) | Sub-section headings |
| <h4> | Medium-Low | 1em (16px) | Minor headings |
| <h5> | Low | 0.83em (13.28px) | Small headings |
| <h6> | Lowest | 0.67em (10.72px) | Least important headings |
Best Practices for Using HTML Headings
Key Guidelines
- Use only one <h1> per page - this should be the main title of your content
- Maintain a logical hierarchy - don't skip heading levels (e.g., don't go from h2 to h4)
- Headings should describe the content that follows them
- Use headings to create a clear document structure
- Headings improve accessibility for screen reader users
- Search engines use headings to understand and index content
- You can style headings with CSS, but maintain the semantic hierarchy
Complete HTML Document Example
Proper Heading Structure in an HTML Document
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<h2>About Me</h2>
<p>Some information about me...</p>
<h2>My Projects</h2>
<h3>Web Development</h3>
<p>Details about web projects...</p>
<h3>Graphic Design</h3>
<p>Details about design work...</p>
<h2>Contact Information</h2>
<p>How to reach me...</p>
</body>
</html>
HTML Headings Compiler
Practice writing HTML headings in the editor below. The live preview will update as you type. Try creating your own heading structure!
Live Preview
@prncgr9 project new #fyp #foryou #new #trending ♬ original sound - Zero influencer 10k
