Tutorials /HTML /HTML Headings

HTML Headings

In HTML, <h1> to <h6> tags are used to define **headings**. Headings are important because they give **structure to your web page** and help both users and search engines understand the content hierarchy.

Headings not only improve **readability** but also play a key role in **SEO (Search Engine Optimization)**.

Example of Headings


<h1>This is Heading 1</h1>
<h2>This is Heading 2</h2>
<h3>This is Heading 3</h3>
<h4>This is Heading 4</h4>
<h5>This is Heading 5</h5>
<h6>This is Heading 6</h6>
  

This is Heading 1

This is Heading 2

This is Heading 3

This is Heading 4

This is Heading 5
This is Heading 6
Note: Browsers automatically add white space (margin) before and after a heading.

By default, browsers render <h1> as the largest heading and <h6> as the smallest.

💡 Key Points about HTML Headings
  • There are 6 levels of headings: <h1> to <h6>.
  • <h1> should be used once per page (main title).
  • Headings create a **content hierarchy** for users and search engines.
  • Do not use headings just for making text big or bold — use **CSS** instead.

Using Headings in a Webpage

A real-world example of headings in a blog page:


<h1>Welcome to My Blog</h1>
<h2>About HTML</h2>
<p>HTML stands for HyperText Markup Language...</p>

<h2>Why Learn HTML?</h2>
<p>HTML is the foundation of all websites...</p>

<h3>Getting Started</h3>
<p>You can start learning HTML with simple tags...</p>
  

Here, the <h1> is used for the page title, <h2> for subtopics, and <h3> for sub-sections.

⚠️ Warning: Do not skip heading levels unnecessarily (e.g., jumping from <h1> directly to <h4>), as it can confuse both readers and search engines.
Use <h1> for the **main title** of your page and structure the rest logically with <h2> to <h6>.

The Coding Journey provides high-quality, beginner-friendly, and advanced web development tutorials. Learn React, Next.js, JavaScript, Tailwind CSS, and more with hands-on projects. Build faster, code smarter, and level up your skills! 🚀

© 2025 All Rights Reserved | The coding journey