Skip to content
FORGENO ADS GAMESUnlock all $8

HTML · Unit 1: Your first web page · Lesson 2 of 5

Headings and paragraphs

Headings name the sections of a page, from <h1> (the most important) down to <h6>.

Opens this lesson in Code Academy. Lessons open one after another, and each unit opens when you pass the checkpoint quiz before it (you can take a checkpoint early to skip ahead). If this lesson is not open yet, the button shows you its unit on your map.

The idea

Headings name the sections of a page, from <h1> (the most important) down to <h6>. A page usually has one <h1> for its main title.

Pick a heading by its place in the outline, not by how big it looks. You can change the size later with CSS.

Each <p> is its own paragraph. Pressing Enter in your code does not start a new paragraph on the page; a new <p> does.

Worked example

HTML

<h1>Trail Guide</h1>
<h2>Before you go</h2>
<p>Pack water and a map.</p>
<h2>On the trail</h2>
<p>Stay on marked paths.</p>

One <h1> for the page, then an <h2> for each section.

Key terms

Heading
<h1> to <h6> name sections of a page by importance. Use one <h1> per page.
Paragraph
A block of text in <p>…</p>. Line breaks in your code do not start new paragraphs.

Practise it in Code Academy

It has 4 exercises (multiple choice, predict the output, write code from a prompt and fix the broken code) and takes about 6 minutes. Every answer is checked as you go, and feedback names the exact mistake. Hints and the solution are there if you get stuck.

Every lesson is free: no ads, no lives and no paywall.