Topic 1.3
Text Formatting and Meaning
In one line
Text-level elements mark what a word means: <strong> for importance, <em> for stress, <mark> for highlights, <del>/<ins> for edits, <sub>/<sup> for small raised or lowered text, and a few more; the look comes free, but the meaning is the point.
Think of it like this
Reading a story out loud. When a word is important ("Do not touch the stove"), you say it seriously. When you stress a word to change the meaning ("I said *Tuesday*, not Monday"), your voice goes up on it. When you mention a ship's name or a foreign word, you just *say it a bit differently*. HTML has a separate element for each of these, so the page carries your voice too.
Words you'll meet
New words in this topic, in plain English. Come back here whenever one feels fuzzy.
- Semantics
- What something means. A semantic element says what its content is, not only how it looks.
- Text-level element
- An element used inside a line of text, like
<em>or<strong>, that doesn't start a new block. - Importance
- What
<strong>marks: a word or phrase that is serious or urgent. - Stress emphasis
- What
<em>marks: the word you'd say louder, which changes the sentence's meaning. - Subscript / superscript
- Text set lower (
<sub>) or higher (<sup>) than the line, like H₂O or x². - Thematic break
- A change of topic between paragraphs, marked with
<hr>. - Word-break opportunity
- A spot inside a long word where the browser may wrap the line if needed, marked with
<wbr>. - Default style
- The look the browser gives an element before you write any CSS, like bold for
<strong>.
Step by step
01Start with plain text
Here is a short notice with no formatting. Read it out loud: which words would you say differently?
<p>Warning: the pool is closed on Monday. The new timings are 6am to 9pm.</p>02Mark what is important
The warning is serious, so it gets <strong>. Screen readers do not always change voice for it, but the meaning is now in the HTML for every tool that reads it.
<p><strong>Warning: the pool is closed on Monday.</strong> The new timings are 6am to 9pm.</p>03Show what changed
The timings were updated. <del> shows the old value and <ins> the new one, with a datetime saying when the change was made.
<p><strong>Warning: the pool is closed on Monday.</strong>
The new timings are <del datetime="2026-10-01">7am to 8pm</del>
<ins datetime="2026-10-01">6am to 9pm</ins>.</p>04Add fine print and a break
A thematic break <hr> separates the notice from the small print, which goes in <small>.
<p><strong>Warning: the pool is closed on Monday.</strong> ...</p>
<hr>
<p><small>Timings may change during school holidays.</small></p>05Pick by meaning, not by look
When unsure, ask the question in this diagram. If none fits, you may not need an element at all, or you want a <span> with CSS (Topic 2.1).
Try it yourself
- 1
Strong or b?
Write this sentence in the first example:
The exam is on Friday. Bring a black pen.Decide which words are important (<strong>) and which only need attention (<b>). Explain your choice in one sentence. - 2
Change the meaning with em
Write
I never said she stole the moneythree times, putting<em>on a different word each time. Read each one aloud: the meaning changes. - 3
Make wbr matter
In the wbr example, predict what happens if you change
width: 160pxtowidth: 400px. Run it and see which boxes still wrap.
Code & diagrams
`strong` and `b` look the same, as do `em` and `i`. The difference is meaning, which you can't see but tools can.
Preview
Console
Nothing logged yet.Expected console output
strong fontWeight 700
b fontWeight 700
em fontStyle italic
i fontStyle italic
mark backgroundColor rgb(255, 255, 0)
del textDecorationLine line-through
ins textDecorationLine underlineThe first box overflows: the browser has nowhere to break the word. The others wrap at the `<wbr>` points. Widen the box to 600px and every `<wbr>` does nothing.
Preview
Console
Nothing logged yet.Preview
Console
Nothing logged yet.Expected console output
Removed: Room 4 on 2026-10-01
Added: Room 7 on 2026-10-01Break it on purpose
Errors are the best teachers. Make each change, read the error, guess what went wrong, then reveal the answer.
Break #1
Underline for emphasis
Write Please <u>read the rules</u> before you start. to make the phrase stand out.
Break #2
Use sup to make text small and raised for decoration
Write <sup>NEW!</sup> next to a menu item to make it look like a badge.
Myth vs fact
Myth
<b> and <i> are deprecated; always use <strong> and <em>.
Fact
Both are valid HTML with their own meanings: <b> for attention without importance, <i> for a different voice. Use each for its meaning.
Myth
Screen readers shout <strong> and stress <em>.
Fact
Most screen readers read them in the normal voice by default. Use them for the meaning anyway: search engines, reader modes, translation tools and future tools all read semantics.
Myth
<small> is for making text smaller.
Fact
<small> means side comments and fine print. To make text smaller for looks, use CSS font-size.
Pro corner
Extra depth for experienced readers. New to this? Skip it for now and come back later.
- ▸
Nesting increases importance:
<strong><strong>very</strong></strong>is valid and means more important. Similarly, nested<em>means more stress. CSSfont-weight: bolderin the default stylesheet is why nested bold can look heavier. - ▸
<s>is not for edits;<del>is.<del>and<ins>can wrap whole blocks (several paragraphs) as well as words, and theirdatetimeis exposed as the DOM propertydateTime. - ▸
<mark>and<del>/<ins>are not announced by most screen readers by default. When the change matters (like a price drop), add visible words such as "was" and "now" so everyone gets it. - ▸
<wbr>differs from the soft hyphen entity­:<wbr>breaks without adding a hyphen,­shows a hyphen only when it breaks. For long URLs, CSSoverflow-wrap: anywhereis often the better fix.
Remember this
- 1
<strong>means strong importance, seriousness or urgency: warnings, key facts.<b>means draw attention without extra importance: keywords in a summary, a product name in a review. Both show in bold by default. Choose by meaning: if the sentence would still be fine read in a calm voice, it's<b>; if the word is a warning or key point, it's<strong>. - 2
<em>means stress emphasis: the word you'd say louder, which changes the meaning of the sentence. "*I* didn't eat the cake" and "I didn't eat the *cake*" mean different things.<i>means a different voice or mood without stress: a technical term, a thought, a ship name, a word from another language (<i lang="fr">déjà vu</i>). Both show in italics by default. - 3
<mark>highlights text that is relevant right now, like search matches on a results page or a line a teacher wants you to notice.<small>is for side comments and fine print: copyright lines, legal notes. It does not mean "make text smaller"; it means "this is small print". - 4
<sub>(subscript) lowers text, as in H<sub>2</sub>O;<sup>(superscript) raises it, as in x<sup>2</sup> or 1<sup>st</sup>. Use them only when the position is part of the meaning (chemistry, maths, footnote numbers), not to make text look fancy. - 5
<del>marks text that was removed from a document and<ins>marks text that was added: a price change, a corrected article. Both can carrydatetimeandciteattributes saying when and why.<s>marks text that is no longer accurate or relevant but wasn't an edit, like an old price next to a sale price.<u>adds an underline for non-textual annotation, such as marking a spelling mistake. Avoid<u>otherwise: people expect underlined text to be a link. - 6
Three void elements control lines:
<br>forces a line break inside text.<hr>marks a thematic break, a change of topic between paragraphs, shown as a horizontal line.<wbr>is a word-break opportunity: it does nothing unless the line runs out of room, then the browser may break a long word or URL there.
Explain it without notes
Explain the difference between <strong> and <b>, and between <em> and <i>.
When do you use <del>/<ins> and when <s>?
What do <hr> and <wbr> do?
Why not choose these elements for how they look?
Practice
Mark up: Caution: the floor is wet. The word café comes from French. Use the right element for the warning and for the French word.
Mark up a sale price: the old price ₹1,200 is crossed out because it's no longer valid, and the new price ₹900 is shown after it. Add a fine-print line underneath saying offers end Sunday.
Write the formula for the area of a circle, A = πr², using a superscript.
Trade-offs
- ↔
Semantic elements cost nothing extra and carry meaning; a
<span>with CSS gives full visual control but no meaning, so use it only when no element fits.
Done when you can
I can choose between
<strong>,<b>,<em>and<i>by meaning.I can use
<mark>,<small>,<sub>and<sup>correctly.I can mark edits with
<del>/<ins>and outdated text with<s>.I know why
<u>is rarely the right choice.I can use
<br>,<hr>and<wbr>and say what each does.