Codeloft
0 0 XP

Headings and emphasis

6 min 20 XP + 10 for no hints

Headings make a page easy to scan. There are six levels, from <h1> (the page title) down to <h6>. Use them like the outline of an essay: one h1, then <h2> for sections and h3 inside those.

Inside a paragraph, <strong> marks words that are important (browsers show them bold) and <em> adds emphasis, the way you stress a word when speaking (shown in italics).

Choose tags for their meaning, not their looks. Screen readers announce headings and use them to jump around a page, so never use a heading just to make text big.

Example
<h1>Banana bread</h1>
<h2>Ingredients</h2>
<p>You need <strong>three ripe bananas</strong>.</p>
<h2>Method</h2>
<p>Mix gently. <em>Don't</em> overmix the batter.</p>
Go down one level at a time. Jumping from h1 straight to h4 confuses screen-reader users.

Your tasks

0 of 3 done
  1. Add an <h2> section heading
  2. Mark something important with <strong>
  3. Stress a word with <em>

Quick check

Which tag should hold the main title of a page?

trip.htmlUpdates as you type