Lesson 2 of 29 · HTML Basics
HTML Headings and Paragraphs: h1–h6, p, strong and em
Text on the web is organised like a good book: a title, chapters, sections and paragraphs. In HTML you build that outline with headings and paragraphs, and you mark the words that matter with <strong> and <em>. In this lesson you'll turn a block of plain text into a well-structured page.
Six levels of headings
HTML has six heading elements, from <h1> (most important) to <h6> (least important). They work like the levels of an outline: the <h1> is the title of the whole page, <h2> elements start its main sections, and <h3> elements divide a section into smaller parts.
<h1>Dragon Care Guide</h1>
<h2>Feeding</h2>
<h3>Breakfast</h3>
<h3>Dinner</h3>
<h2>Training</h2>
Browsers show higher-level headings bigger and bolder, but that is not why they exist. Choose a level for its place in the outline, never for its size — you'll control sizes with CSS later.
Why only one <h1>?
Headings are not just decoration. Screen reader users jump from heading to heading to skim a page, and search engines read headings to work out what a page is about. The <h1> answers the question "what is this page?", so a page should have exactly one. Below it, don't skip levels: an <h2> is followed by <h3>, not by <h4>.
Paragraphs and line breaks
Normal text goes in paragraphs: <p>…</p>. Each paragraph starts on a new line, with some space above and below it.
Here's a surprise for every beginner: the browser ignores line breaks and extra spaces in your code. Any run of spaces, tabs and new lines becomes a single space. When you really need a line break inside a paragraph — in an address or a poem — use <br>:
<p>Roses are red,<br>violets are blue.</p>
<br> is an empty element: it has no content and no closing tag. Use it for line breaks within one block of text, not to create space between paragraphs — that's what separate <p> elements are for.
Important and emphasised text
Two elements give words extra meaning inside a paragraph:
<strong>marks text as important: a warning, a key fact. Browsers show it in bold.<em>adds emphasis: the stress you'd put on a word when speaking. Browsers show it in italics.
<p><strong>Warning:</strong> the dragon is <em>very</em> hungry.</p>
Screen readers can change their voice for these words. That's why they beat <b> and <i>, which only change how the text looks without saying why.
Common mistakes
- Picking a heading for its size. An
<h4>because "it looks right" breaks the outline. Pick the level, style it later. - Several
<h1>elements. Keep one page title and use<h2>for the sections. <br><br>for spacing. Two separate paragraphs are cleaner and easier to style.- Crossed tags.
<p><strong>Hi</p></strong>is wrong — close the inner element first:<p><strong>Hi</strong></p>.
Assignment
The page below already contains the right text, but no tags — look at the Preview: it all runs together on one line. Mark it up:
Dragon Care Guideis the page's only<h1>.FeedingandSleepingare<h2>headings, in this order.- Right after
Feedingcomes a paragraph:Dragons eat three times a day.— with the wordthreein<strong>. - Right after
Sleepingcomes a paragraph on two lines:Never wake a sleeping dragon., a<br>, thenThey wake up grumpy.— with the wordgrumpyin<em>.
Keep learning
Need a quick reminder? The HTML & CSS cheat sheet has every topic of Learn HTML & CSS on one page.
Lesson last updated on .