Learn HTML and CSS: Emphasis
Emphasis and line breaks
"New: sea salt caramel!" Maggie wants everyone to see it. "Can you make that word thicker?" Of course. But thicker isn't the whole story.
strong and em
Sometimes one word matters more than the rest of the sentence. Put it in <strong>: the browser shows it in bold, and a screen reader stresses it.
<em>, short for "emphasis", adds the stress you'd hear when you say it: "that's really tasty", with the stress on really. The browser puts it in italics.
They sit in the middle of a sentence, inside a <p>: the sentence just carries on, on the same line.
<main> <p><strong>New:</strong> sea salt caramel.</p> <p>That's <em>really</em> tasty, says Maggie.</p></main>Why not b?
<b> and <i> exist too, and they look the same: bold and italic. But they don't mean anything. <b> only says "make this bold", and a screen reader reads it as ordinary text.
HTML is about meaning, not looks. Is something important? <strong>. Are you stressing it? <em>. Do you only want something to look different? Then CSS is your tool, from module 2 onwards.
<main> <p><strong>Important</strong> and <b>just bold</b>.</p> <p><em>Stressed</em> and <i>just italic</i>.</p></main>A new line with br
An address takes up two lines, but it's one whole: one paragraph. A line break in your code doesn't help, it became a space, remember? That's what <br> is for: a line break.
<br> has no content, so it has no closing tag either. An element like that is called an empty element.
Don't use <br> to make space between paragraphs: that's what two <p>s are for.
<main> <h2>Address</h2> <p>12 Marine Parade<br>Brighton BN2 1TL</p></main>Try it yourself
Make free important and put stress on really. Choose the elements that mean something.
<main> <p>A free waffle with every sundae.</p> <p>Try it, it's really worth it.</p></main>body { margin: 0; font-family: system-ui, sans-serif; background: #fff8f0; color: #3b2a1a;}header { padding: 24px 16px; background: #ffd6e0;}.logo { display: inline-block; margin: 8px 0 0; padding: 6px 18px; border-radius: 999px; background: #ffffff; font-size: 28px;}.slogan { margin: 8px 0 0;}main { padding: 8px 16px 24px;}Ready for more?
The full lesson has 5 exercises, from easy to challenging, with hints, points and a streak you can build.
Start the lesson