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>
<h1>
in importance. Example:<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>
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.