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.
<p> tag works and
what it rendersWhat 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>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.
<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.
<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.<h1> and related keywords in <h2>/<h3>. Search
engines weight heading text more heavily than body text.<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.
<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>
<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 |
<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:
<h1>Page Title</h1>
<h2>Section</h2>
<h3>Subsection</h3>
<p>Body text here.</p>
<p>Another paragraph.</p>
<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.
<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:
<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.
<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.
Quick Check — Chapter 4
Expand each question below to check your understanding before moving to the quiz.
<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.
<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.
<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.
<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.
<h2>, the next nested level must be
<h3>.
<h1> tags should a page ideally
have for good SEO?- 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>.
Rate Us on Google
Join Our Learning Community
Connect with thousands of learners, get daily tips, ask questions, and stay updated with new tutorials.