w1coding.comAll tutorials

HTML Heading

HTML lessons
  1. Environment Setup
  2. Introduction
  3. Basics
  4. Editors
  5. Elements
  6. Attributes
  7. Heading
  8. Paragraphs
  9. Styles
  10. Formatting
  11. Quotations
  12. Comment
  13. Colors
  14. CSS
  15. Links
  16. Images
  17. Favicon
  18. Title
  19. Tables
  20. Block And Inline
  21. Lists
  22. Div
  23. Classes
  24. ID
  25. Iframes
  26. Responsive

What are HTML Headings?

HTML headings are used to define the headings of a webpage. They range from <h1> to <h6>, with <h1> being the most important and <h6> the least important.

Here is an example of an <h1> heading:

<h1>This is a Main Heading</h1>

Types of HTML Headings

HTML provides six levels of headings:

  • <h1>: The highest level heading, typically used for the main title of the page or a section. Example:
  • <h1>Main Title</h1>
  • <h2>: Used for subheadings that are just below <h1> in importance. Example:
  • <h2>Subheading Level 1</h2>
  • <h3>: A sub-subheading, used for further breakdown of content. Example:
  • <h3>Subheading Level 2</h3>
  • <h4>: Often used for minor headings within a section. Example:
  • <h4>Subheading Level 3</h4>
  • <h5>: Used for small subheadings, rarely applied in standard websites. Example:
  • <h5>Subheading Level 4</h5>
  • <h6>: The smallest heading level, typically used for the least important headings. Example:
  • <h6>Subheading Level 5</h6>

Heading Structure

It’s important to structure headings in a logical order to maintain a clear hierarchy on the webpage. Here's an example of how you might structure headings:

<h1>Main Title of the Web Page</h1>
  <h2>Section 1 Title</h2>
    <h3>Subsection 1.1 Title</h3>
    <h3>Subsection 1.2 Title</h3>
  <h2>Section 2 Title</h2>
    <h3>Subsection 2.1 Title</h3>
    <h4>Further Breakdown of Subsection 2.1</h4>
            

This helps search engines and screen readers understand the hierarchy and importance of content on the page.

Best Practices for Using Headings

  • Use only one <h1> on a page. It should represent the main topic of the webpage.
  • Follow a logical order: Do not skip heading levels (e.g., avoid using <h3> directly after <h1>).
  • Use headings to structure content: Break down your content into sections and subsections to enhance readability.
  • Make headings descriptive: Ensure headings accurately describe the content that follows.