HTML Headings | Organizing Content with Titles

In HTML, headings are used to define the structure and hierarchy of content on a webpage. The <h1> to <h6> tags are used to create headings of different levels, where <h1> is the most important and <h6> is the least important. Proper use of headings is essential for both readability and SEO (Search Engine Optimization).

What are HTML Headings?

Headings in HTML help define the main topics and subtopics of the content. They are block-level elements, meaning they start on a new line and take up the full width of their container. Headings are vital for organizing your content and making it easier for users and search engines to understand the structure of your webpage.

Basic Syntax of HTML Headings:

Using Headings in HTML

<h1>Main Heading</h1>
<h2>Subheading Level 1</h2>
<h3>Subheading Level 2</h3>
<h4>Subheading Level 3</h4>
<h5>Subheading Level 4</h5>
<h6>Subheading Level 5</h6>

HTML Heading Tags:

Example of Using HTML Headings:

The following code demonstrates the use of headings for organizing content:

Code Example


<!DOCTYPE html>
<html>
    <head>
        <title>HTML Heading Example</title>
    </head>
    <body>
<h1>Main Heading of the Page</h1>
<h2>Introduction to HTML</h2>
<h3>What is HTML?</h3>
<h4>History of HTML</h4>
<h5>HTML in the Early Days</h5>
<h6>HTML Today</h6>
</body>
</html>

Output

Main Heading Of the Page
Introduction to HTML
What is HTML ?
History Of HTML
HTML in Early Days
HTML Today

Best Practices for Using HTML Headings:

Headings are an essential part of web development, as they organize content, provide structure, and improve the user experience. By following best practices for headings, you can create well-structured and easily navigable webpages.