Text is the substance of most pages, and the markup around it is what turns a wall of sentences into something you can navigate. Headings give a document its skeleton, paragraphs give it breathing room, and a screen reader turns both into a table of contents you can jump around in.
This is the first lesson in the HTML Elements and Tags module, and the next lesson in this module is about "How Do Links Connect Pages, Anchors and Email?".
How do the heading levels work?
There are six heading levels, from the <h1> to the <h6>, and together they form an outline of the page.
The levels are not a font-size menu. They are the structure, and that structure is what assistive technology and search engines read.
<h1>The one title of the page</h1>
<h2>A major section</h2>
<h3>A subsection</h3>
<h3>Another subsection</h3>
<h2>Another major section</h2>
<h3>A subsection</h3>The rules are simple. A page normally has exactly one <h1>, and that heading names the page. The headings nest without skipping a level, so an <h3> always sits under an <h2>.
You can style each level however you like, so the visual size and the outline level do not have to match. Plenty of sites show an <h2> larger than an <h1> without any problem, because the level is about meaning and not about appearance.
Why do skipped levels cause problems?
Because a screen reader user can navigate by heading level. If you jump from the <h1> straight to the <h3>, the outline the user hears has a hole in it, and they lose their sense of where they are.
It is the same reason a table of contents with missing entries is hard to follow.
<!-- avoids a skipped level -->
<h2>Installing the toolkit</h2>
<h3>On Windows</h3>
<h3>On Linux</h3>
<!-- skips h2 — the outline is broken -->
<h2>Installing the toolkit</h2>
<h4>On Windows</h4>Search engines use the same outline to decide what a section is about, and a flat, well-nested structure makes it obvious which passage answers which query.
How do the paragraphs work?
A paragraph is a block of text, and a block element always starts on a new line and ends with a blank line after it.
The <p> element is what creates that separation. A newline in your source file does not.
<p>This is the first paragraph.</p>
<p>This is the second paragraph, and it starts on a new line because the
first one was closed.</p>That last point surprises people who come from plain text files, where a newline creates a new line.
In HTML, the source formatting is invisible. The browser collapses the whitespace, so a paragraph broken across several lines in your editor still renders as one continuous block.
You use a paragraph break for a new paragraph, and you let your editor wrap the long lines.
When do you need a line break?
Almost never in the body of the text.
The <br> element exists for the cases where the break is part of the content rather than part of the formatting. That is an address, a list of directions, or a poem.
<address>
14 Cathedral Street
<br>
Edinburgh
<br>
EH1 5TS
</address>Using <br> to force visual line breaks is a classic mistake.
It makes the text look right at one screen width and wrong at every other one, because the break sits in the markup rather than in the layout.
The same effect, done properly, comes from styling the block rather than the line.
What about the inline elements?
The text inside a paragraph can carry meaning with inline elements. There is <strong> for importance, <em> for emphasis, <code> for code, <time> for a date, and <a> for a link.
These sit inside the flow of the paragraph without breaking it.
<p>
Set the value with <code>--port</code>, then restart the server.
<strong>Do not</strong> edit the file while it is running.
Released <time datetime="2026-10-14">last Tuesday</time>.
</p>There are two details worth knowing.
The <strong> and the <em> carry meaning that survives the removal of the style, so you should not use them purely for looks. Use the CSS for that.
And the <time> element takes a machine-readable datetime attribute, so a screen reader can announce the full date while the visible text stays readable.
What is the horizontal rule for?
The <hr> is a thematic break. It is a visible line that marks a division between unrelated parts of the content.
It is not a spacer, and it is not decoration. If you want space between sections, that is what margins are for.
<p>The first half of the content.</p>
<hr>
<p>A genuinely different topic begins here.</p>How do you keep long text readable?
Long-form reading depends on two typographic settings that have nothing to do with the markup. There is the line height, and there is the measure, which is the width of the line.
A comfortable line runs roughly sixty to eighty characters, and the line height should be around 1.5 times the font size for body text.
Both of them are styling decisions, and both of them belong in your stylesheet rather than in the HTML.
body {
font-size: 1rem;
line-height: 1.6;
}
article {
max-width: 68ch; /* roughly 70 characters per line */
}Using ch units for the measure is a neat trick. The measure is then defined in characters, so it stays correct whatever font you use.
A paragraph of prose that runs the full width of a large monitor is genuinely tiring to read, and this is the property that prevents it.
Quick reference
- One
<h1>per page, and you nest the levels without skipping any. - Headings are structure and not size, so you can style them any way you like.
- The blank line between paragraphs comes from the
<p>element, and not from the source file. - You use the
<br>only when the line break is part of the content. - The
<strong>and the<em>carry the meaning, and you use the CSS for pure looks. - The
<hr>marks a thematic break and not a gap.
Try it yourself: you write a page with an <h1>, two <h2> sections, and an <h3> under the first one. Then you deliberately skip a level and you check the document outline in the developer tools, where the headings appear as a nested tree. You fix it and you look at the tree again.