Tutorials HTML Headings & Paragraphs
Ch 4 / 40
Chapter 4 Beginner 7 min read HTML

HTML Headings & Paragraphs

Headings and paragraphs are the two most fundamental building blocks of any web page. Every article, blog post, and web app uses them. In this chapter you'll learn exactly how to use <h1>–<h6> and <p> with correct semantics, SEO best practices, and proper formatting.

What you'll learn
What HTML headings are and how all six levels work
Default browser sizes for h1 through h6
When to use each heading level (hierarchy rules)
How the <p> tag works and what it renders
SEO impact of headings and how to use h1 correctly
Common mistakes and best practices to avoid them

What Are HTML Headings?

HTML provides six levels of headings — <h1> through <h6>. They mark up titles and subtitles on a page, creating a clear content hierarchy that both users and search engines rely on.

Headings are block-level elements — each one starts on a new line and browsers apply bold styling and progressively smaller sizes by default, from h1 (largest) to h6 (smallest).

<h1> Page Title ~2em · 32px
<h2> Section Heading ~1.5em · 24px
<h3> Sub-section Heading ~1.17em · 18.7px
<h4> Topic Heading 1em · 16px
<h5> Minor Heading 0.83em · 13.3px
<h6> Smallest Heading 0.67em · 10.7px
HTML — All Six Headings
<h1>This is a Heading 1</h1>
<h2>This is a Heading 2</h2>
<h3>This is a Heading 3</h3>
<h4>This is a Heading 4</h4>
<h5>This is a Heading 5</h5>
<h6>This is a Heading 6</h6>

Heading Hierarchy — How to Use Them Correctly

Headings are not just about size — they define a document outline. Think of them like a book: the book title is h1, chapter titles are h2, sections within a chapter are h3, and so on.

<h1> K2infocom — Free Coding Tutorials Page title — only one per page
<h2> HTML Tutorial
<h3> HTML Basics
<h4> Headings & Paragraphs
<h5> The <h1> Tag
<h6> Browser default size for h1
Key Rule
Never skip heading levels. If you have an <h2>, the next level down should be <h3> — not <h4> or lower. Skipping levels breaks the document outline and confuses screen readers.

Headings & SEO — Why They Matter

Search engines use your heading structure to understand what your page is about. Getting headings right has a direct impact on your Google ranking.

One <h1> per page
The <h1> is the most important heading on the page. Use it exactly once — it tells search engines the primary topic of the page. Using multiple h1 tags dilutes its SEO value.
Include keywords in headings
Place your main keyword naturally in the <h1> and related keywords in <h2>/<h3>. Search engines weight heading text more heavily than body text.
Headings help screen readers
Assistive technologies allow users to navigate a page by jumping between headings. A logical heading hierarchy makes your content accessible to everyone.
Don't use headings just for size
Never use <h3> because "it looks the right font size". Use CSS to control size. Headings carry semantic meaning — use them for structure, not styling.

The HTML Paragraph Tag — <p>

The <p> tag defines a paragraph of text. It is a block-level element — the browser automatically adds a margin above and below each paragraph to create visual separation between blocks of text.

HTML — Paragraph Tag
<p>This is the first paragraph. The browser adds space above and below it automatically.</p>

<p>This is the second paragraph. Notice the automatic gap between them — no CSS needed.</p>

<p>
  You can write a long paragraph across
  multiple lines in your code — the browser
  collapses all the whitespace into a single line.
</p>
White Space Collapsing
HTML collapses all extra spaces, tabs, and newlines inside a <p> tag into a single space. If you need a line break inside a paragraph, use <br>. If you need preserved spacing, use the <pre> tag.

Text Formatting Inside Paragraphs

Several inline tags work inside <p> to add meaning and emphasis to text:

Tag Renders As Semantic Meaning Example
<strong> Bold Important / strong emphasis <strong>Important!</strong>
<em> Italic Stressed / alternative voice <em>emphasized</em>
<br> Line break Single line break (self-closing) Line 1<br>Line 2
<mark> Highlighted Highlighted / relevant text <mark>found text</mark>
<small> Smaller text Fine print / side comment <small>Terms apply</small>
<sup> / <sub> H2O / E=mc2 Superscript / Subscript H<sub>2</sub>O
HTML — Formatting Inside a Paragraph
<p>
  HTML stands for <strong>HyperText Markup Language</strong>.
  It was invented by <em>Tim Berners-Lee</em> in 1991.
  The chemical formula for water is H<sub>2</sub>O.
  Use <mark>highlighted text</mark> to draw attention.
</p>

Common Mistakes — Do's & Don'ts

These are the most frequent heading and paragraph mistakes beginners make:

Do — Correct
<h1>Page Title</h1>
<h2>Section</h2>
<h3>Subsection</h3>
<p>Body text here.</p>
<p>Another paragraph.</p>
Don't — Wrong
<h1>Title</h1>
<h1>Another Title</h1>  ← 2× h1
<h4>Skip levels</h4>  ← skipped h2/h3
<h3>Big text</h3>  ← used for size only
This is bare text with no <p> tag.
Never Do This
Don't put raw text directly inside <body> without wrapping it in a <p> tag. Always wrap text content in an appropriate element for clean, valid HTML.

Complete Example — Headings & Paragraphs Together

Here is a realistic example of how headings and paragraphs work together in a typical blog article page:

HTML — Article with Headings & Paragraphs
<article>

  <h1>Getting Started with HTML</h1>
  <p>HTML is the foundation of every web page. 
  Learning it is the first step in your web development journey.</p>

  <h2>What is HTML?</h2>
  <p>HTML stands for <strong>HyperText Markup Language</strong>. 
  It uses tags to structure content on the web.</p>

  <h2>Why Learn HTML?</h2>
  <p>HTML is the starting point for all web development. 
  Without HTML, there is no web page — no matter how good 
  your CSS or JavaScript skills are.</p>

  <h3>HTML is Easy to Learn</h3>
  <p>You can write a working HTML page in under 
  <em>10 minutes</em> — no tools or installations needed.</p>

</article>

Try It Yourself

Edit the headings and paragraphs below and click Open in Editor for a full-screen live view.

Live Editor
✎ Editor
👁 Preview
Try This
Change <h1> to <h3> and notice the font size difference. Then add a new <p> tag with your own text to see how paragraphs stack automatically.
Free Resource
HTML5 Cheat Sheet — All Tags & Attributes
One printable PDF covering every HTML5 tag, heading level, paragraph rule, and semantic element. Perfect for quick reference.
Download PDF
Featured Course — Enroll Now
Modern Web Development With AI
Master HTML, CSS, JavaScript, React, and Node.js — all in one industry-ready curriculum. Build real projects and get placement support.
120+
Chapters
40 hrs
Content
10
Projects
4.9 ⭐
Rating
HTML5 CSS3 JavaScript React.js Node.js MongoDB AI Tools

Quick Check — Chapter 4

Expand each question below to check your understanding before moving to the quiz.

Questions & Answers
HTML provides six heading levels — <h1> through <h6>. The <h1> is the largest and most important, while <h6> is the smallest. All headings are bold and block-level by default, meaning each one starts on a new line.
The <h1> tag signals to search engines the primary topic of your page. Using multiple <h1> tags dilutes its SEO value because the browser and search engine can no longer determine which heading is most important. One <h1> per page is the widely accepted best practice for both SEO and accessibility.
HTML collapses all whitespace — multiple spaces, tabs, and newlines are all rendered as a single space in the browser. This is called "white space collapsing". If you need a visible line break inside a paragraph, use the self-closing <br> tag. If you need to preserve spacing exactly (like in code or poetry), use the <pre> tag instead.
<strong> renders text in bold and carries the semantic meaning of strong importance — the content is critical or urgent. <em> renders text in italic and means stressed emphasis, like changing the tone of a word. Both are semantic tags — they convey meaning to browsers, search engines, and screen readers, not just visual style. Use <b> and <i> only when you want visual styling with no semantic meaning.
Headings carry semantic meaning — they define the structure and hierarchy of your document. Screen readers announce headings to visually impaired users so they can navigate the page. Search engines use them to understand content structure. If you use <h3> just because "it's the right size", you create a broken document outline. Always use CSS to control font size and appearance — reserve heading tags for their structural purpose.
Technically the browser will still render it, but it is bad practice. Skipping heading levels breaks the logical document outline that screen readers and search engines depend on. It is like going from Chapter 1 to Chapter 3 in a book — confusing and disjointed. Always use headings in order: if the current section is <h2>, the next nested level must be <h3>.
Multiple Choice Questions
MCQ 1 of 4
Which HTML heading tag produces the largest text by default?
MCQ 2 of 4
What tag is used to define a paragraph of text in HTML?
MCQ 3 of 4
Which tag makes text bold with semantic importance in HTML?
MCQ 4 of 4
How many <h1> tags should a page ideally have for good SEO?
Chapter Summary
  • HTML provides six heading levels — <h1> to <h6>. All are block-level and bold by default, with h1 being the largest.
  • Use only one <h1> per page — it signals the main topic to search engines and screen readers.
  • Never skip heading levels. If the current level is h2, the next nested level must be h3 — not h4 or lower.
  • The <p> tag defines a paragraph. Browsers add top and bottom margins automatically. Extra spaces inside collapse to one.
  • Use <strong> for important text (bold + semantic) and <em> for stressed text (italic + semantic).
  • Never use headings just for their default size — use CSS for styling. Headings are for document structure and meaning.
  • Always wrap body text in <p> tags. Never leave raw text directly inside <body>.
~7 min read
Beginner level
Chapter 4 of 40

Rate Us on Google

4.8 / 5
Enjoying this tutorial?
If this tutorial helped you, a 5-star Google review means a lot. It helps other learners discover our free content and motivates us to keep improving.
500+ Reviews (Target)
Write a Google Review
Join WhatsApp Channel