Text, headings & paragraphs
4 min lesson
- Headings and paragraphs are the basic building blocks for putting readable text on a page.
- HTML has six heading levels from <h1> (most important) to <h6> (least important), and one paragraph tag <p>.
- Think of a document outline: h1 is the title, h2 is a chapter, h3 is a section, and paragraphs hold the words.
- Headings are not for making text big; they describe structure, and browsers and screen readers use them to navigate.
- Paragraphs are block elements and always start on a new line with space around them.
- This builds on Semantic HTML: you now use meaning-carrying tags for real content.
- The example has one h1, two h2 headings and paragraphs under each; you will see a clear outline on screen.
- Next, Inline text formatting adds emphasis inside these blocks.
- Use one h1 per page for the main title.
- Move from h1 to h2 to h3 without skipping levels.
- Use <p> for text, never for layout gaps.
- Headings describe structure, so pick them by meaning, not by size.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Headings & paragraphs</title>
</head>
<body>
<!-- The main title of the page; use only one h1 -->
<h1>Learning HTML</h1>
<!-- A short intro paragraph -->
<p>HTML gives structure to text on the web.</p>
<!-- A section heading one level below h1 -->
<h2>Why it matters</h2>
<p>Clear structure helps readers and search engines.</p>
<!-- Another section at the same level -->
<h2>How to start</h2>
<p>Begin with a heading and a paragraph, then grow.</p>
</body>
</html>What happens: A page with the big heading "Learning HTML", the paragraph "HTML gives structure to text on the web.", the heading "Why it matters", the paragraph "Clear structure helps readers and search engines.", the heading "How to start", and the paragraph "Begin with a heading and a paragraph, then grow."
Breaking it down
h1 heading
<h1>Learning HTML</h1>The most important heading on the page. Use one per page so the main topic is clear.
h2 heading
<h2>Why it matters</h2>A section heading under h1. It starts a new group of related content.
paragraph
<p>HTML gives structure...</p>A block of normal text. Each paragraph starts on a new line and has spacing around it.
Heading levels
| Tag | Use for |
|---|---|
| h1 | The page's main title, once |
| h2 | Major sections |
| h3 | Subsections of an h2 |
| h4 | Smaller subsections |
| h5 | Rare, deep detail |
| h6 | Rare, deepest level |
A helpful analogy
Headings and paragraphs are like a book's table of contents and its pages. The table of contents shows the structure, and the pages hold the words. If every line were a title, the book would be impossible to follow.
Nesting rules
- 1.Do not skip heading levels: h1 then h2 then h3, never h1 straight to h4.
- 2.Never put a heading inside a paragraph; they are separate blocks.
Common mistakes
Using headings to make text big
Avoid
<h3>Important note</h3> because it should look biggerUse instead
<p><strong>Important note</strong></p>Headings describe structure, not size. Use CSS to change size and keep headings for real sections.
Several h1 elements on one page
Avoid
<h1>Title</h1> ... <h1>Another title</h1>Use instead
<h1>Title</h1> ... <h2>Another section</h2>Multiple h1 tags confuse the page outline. Keep one main title and use h2 for the rest.
Quick tips
- •Look at the browser's reader mode; it builds an outline from your headings, which shows if the structure is right.
- •Write the outline first on paper, then turn each line into a heading and each note into a paragraph.