HTML Headings

HTML headings are used to define the titles and subtitles of a webpage. They organize the content into different sections, making the page easy to read and understand. HTML provides six heading tags, from <h1> to <h6>. The <h1> tag is the most important heading, while <h6> is the least important. Search engines and screen readers use headings to understand the structure of a webpage, which improves SEO and accessibility.


Syntax


<h1>Main Heading</h1>

<h2>Sub Heading</h2>

<h3>Section Heading</h3>

<h4>Sub Section Heading</h4>

<h5>Small Heading</h5>

<h6>Smallest Heading</h6>


Example


<!DOCTYPE html>

<html>


<head>

    <title>HTML Headings Example</title>

</head>



<body>


    <h1>Welcome to My Website</h1>


    <h2>About Us</h2>


    <h3>Our Services</h3>


    <h4>Web Development</h4>


    <h5>Frontend Development</h5>


    <h6>HTML Basics</h6>



</body>



</html>



Output

Welcome to My Website

About Us

Our Services

Web Development

Frontend Development
HTML Basics

Importance of HTML Headings

Headings help organize the content of a webpage into logical sections. They make it easier for users to scan and understand information. Search engines use headings to determine the main topics of a page, which can improve search engine rankings. Screen readers also rely on headings to help visually impaired users navigate webpages efficiently.


Best Practices

  • Use only one <h1> tag for the main page title.
  • Use headings in the correct order from <h1> to <h6>.
  • Do not skip heading levels unnecessarily.
  • Keep headings short, meaningful, and descriptive.
  • Use headings to organize page content into sections.
  • Headings improve SEO and accessibility.
  • Avoid using headings only to increase text size.
  • Combine headings with paragraphs for better readability.