Headings, paragraphs and text

Lesson 2 of 14 11 min read Free lesson

Organise text with six levels of headings, paragraphs, line breaks and emphasis.

Six levels of headings

Headings go from <h1> (most important) to <h6> (least). Use them like the outline of a document, not just to make text big: search engines and screen-reader users rely on them to understand and move around your page.

HTML Try it in CodeLab
<h1>Youth Conference 2026</h1>
<h2>Programme</h2>
<h3>Day one</h3>
<p>Registration starts at 9 a.m.</p>
<h3>Day two</h3>
<p>Workshops all afternoon.</p>

Paragraphs and line breaks

Each paragraph goes in its own <p>. The browser ignores extra spaces and new lines in your code, so pressing Enter in your file does not start a new line on the page.

HTML Try it in CodeLab
<p>This     has    lots of
   spaces, but shows as one line.</p>
<p>Line one<br>Line two</p>
<hr>
<p>A new section after a horizontal rule.</p>
Output
This has lots of spaces, but shows as one line.
Line one
Line two
────────────
A new section after a horizontal rule.

Meaningful text elements

ElementMeaningUsually looks
<strong>ImportantBold
<em>Stressed (spoken with emphasis)Italic
<mark>Highlighted for referenceYellow background
<small>Side comment, fine printSmaller
<blockquote>A quotation from somewhere elseIndented
<code>A piece of computer codeMonospace
HTML Try it in CodeLab
<p>Bring your <strong>registration slip</strong> on the <em>first</em> day.</p>
<blockquote>Train up a child in the way he should go.</blockquote>
<p>Type <code>npm start</code> to run the app.</p>

Exercise

Write a short article: an <h1> title, two <h2> sections, a paragraph under each, and one important phrase marked with <strong>.

Starting code Try it in CodeLab
<h1></h1>
Show a possible solution
Solution
<h1>Why I am learning to code</h1>
<h2>My goal</h2>
<p>I want to build a <strong>website for my parish</strong>.</p>
<h2>My plan</h2>
<p>One lesson every day, then practise in the Playground.</p>

Check your understanding

Quick check

How many <h1> headings should a page usually have?

Quick check

Which tag marks text as important?

Quick check

You press Enter three times inside a <p> in your file. What does the browser show?

Hi there! 👋 Have a question about the courses or joining the class? Ask me.