HTML Headings

What Are HTML Headings?

HTML headings are used to define titles and section headers. They range from <h1> (largest and most important) to <h6> (smallest).

Syntax

<h1>Main Title</h1>
<h2>Subheading</h2>
<h3>Sub-subheading</h3>

All heading tags are block-level and automatically add top and bottom spacing.

Hierarchical Order

Headings should follow a logical order. For example:

  • <h1> – Page title
  • <h2> – Section title
  • <h3> – Subsection title

Skipping heading levels (like jumping from <h1> to <h4>) is discouraged.

SEO Importance

Search engines like Google use headings to understand your content hierarchy. Make sure each page has exactly one <h1> tag.

Accessibility

Headings help users using screen readers navigate your content more efficiently. They provide structure and context.

Practice Prompt

Create a basic outline with heading tags:

<h1>HTML Tutorial</h1>

<h2>Getting Started</h2>
<p>This section explains the basics.</p>

<h2>Elements</h2>
<h3>Block vs Inline</h3>
<p>This subsection explains the difference.</p>

Need Help?

Ask the AI if you need help understanding or want to dive deeper in any topic