HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

Headings

HTML headings are used to define titles and subtitles on a web page. They are one of the most important structural elements in HTML.


HTML Heading Tags

HTML provides six levels of headings, from <h1> (most important / largest) to <h6> (least important / smallest):

<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

Here is how each heading looks in a browser:

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Headings Tag Reference

Tag Description Default Size
<h1>Most important heading — page title2em (32px)
<h2>Section heading1.5em (24px)
<h3>Sub-section heading1.17em (~18.7px)
<h4>Sub-sub-section heading1em (16px)
<h5>Minor heading0.83em (~13.3px)
<h6>Least important heading0.67em (~10.7px)

Headings and SEO

Search engines use headings to understand the structure and topic of your page. The <h1> heading carries the most weight for SEO:

  • Use exactly one <h1> per page — it should describe the main topic
  • Use <h2> for major sections
  • Use <h3> for sub-sections under <h2>
  • Never skip heading levels (don't jump from <h1> to <h3>)
  • Do not use headings just to make text bigger — use CSS for that
SEO Note: Google reads your <h1> to understand what the page is about. Make it descriptive, keyword-rich, and unique for every page.

Headings and Page Structure

Think of headings like a document outline. Here is a good structure for a web page:


<h1>Learn HTML</h1>        <!-- Page title -->
<h2>Introduction</h2>      <!-- Section 1 -->
<h3>What is HTML?</h3>     <!-- Sub-section -->
<h3>History of HTML</h3>   <!-- Sub-section -->
<h2>HTML Elements</h2>     <!-- Section 2 -->
<h3>Tags</h3>
<h3>Attributes</h3>
<h2>HTML Forms</h2>        <!-- Section 3 -->

Bigger Headings with Style

You can change the size of any heading using the style attribute and the font-size CSS property:

<h1 style="font-size: 60px;">Very Large Heading</h1>
<h1 style="font-size: 20px;">Small h1 Heading</h1>
Best Practice: Use headings for structure and meaning, not for visual size. If you only want bigger text, use CSS font-size on a <p> or <span> instead.