Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 122 Β· Text Content

Formatting Text

Format text by meaning, not looks. Learn strong vs b, em vs i, plus u, s, mark, small, sub, sup, ins and del, with clear rules for when to use each one.

Inside a paragraph, some words need special treatment: a warning that must not be missed, a word you would stress when speaking, a chemical formula, a price that has changed. HTML has a small set of inline text elements for these jobs.

The most important idea in this lesson is that each of these elements describes what the text is, not just how it should look. Several of them look identical in a browser β€” <strong> and <b> are both bold β€” yet they mean different things. Choosing by meaning helps screen readers, search engines, translation tools and anyone who restyles your page later. If you only want a visual effect, that is a job for CSS.

Importance and stress: <strong> and <em>

<strong> marks text that is important, serious or urgent β€” the part a reader must not miss. Browsers show it in bold.

<em> marks stress emphasis: the word you would say differently when reading aloud. Browsers show it in italics. Moving the stress changes the meaning of a sentence:

strong and em

The three last sentences use the same words, but each one claims something different. That difference is part of the content, so it belongs in HTML.

You can nest these elements to increase the level: <strong> inside <strong> is even more important, and <em> inside <em> is even more strongly stressed. Use this rarely β€” if everything is important, nothing is.

Attention without importance: <b> and <i>

<b> and <i> were once purely visual tags. In modern HTML they have their own, more modest meanings:

  • <b> draws attention to words without making them more important β€” for example key terms in a summary, product names in a review, or the opening words of an article.
  • <i> marks text in an alternate voice or mood β€” a technical term, a phrase from another language, a character's thoughts, the name of a ship, or a scientific name.
HTML
<p>Our test kitchen tried the <b>Breadmaster 3000</b> for a month.</p>

<p>The word <i lang="fr">croissant</i> means "crescent".</p>

<p>The <i>Pseudotsuga menziesii</i> is often sold as a Christmas tree.</p>

When you use <i> for a foreign phrase, add a lang attribute so screen readers can pronounce it correctly and translation tools know what it is.

Which one should I use?

Ask yourself one question: would the meaning change if the formatting disappeared?

If the text is… Use
Important, urgent or a warning <strong>
Stressed, changing the meaning of the sentence <em>
Highlighted for attention, but not more important <b>
A term, foreign phrase, thought or title-like name <i>
Bold or italic purely for decoration a CSS class, no special element

About screen readers: most screen readers do not change their voice for <strong> or <em> by default. That is not a reason to skip them β€” the meaning is still in the page for any tool that uses it, and users can turn on announcements. It is a reason not to rely on bold or italics alone for critical information; say it in words too.

Titles of books, films and other works have their own element, <cite>, which you will meet in Quotations, Citations and Abbreviations.

Highlights and side notes: <mark> and <small>

<mark> highlights text because it is relevant in the current context β€” like a highlighter pen. The classic use is showing search matches. Browsers give it a yellow background.

<small> is for side comments and fine print: legal notes, copyright lines, short disclaimers. Browsers make it a little smaller, but the point is its role, not its size.

Below and above the line: <sub> and <sup>

<sub> (subscript) and <sup> (superscript) are for typographic conventions where the position is part of the meaning: chemical formulas, exponents, footnote markers.

mark, small, sub and sup

Do not use <sup> or <sub> just to move text up or down for decoration β€” use CSS for that. For serious mathematics, HTML has a full language of its own, covered in Math with MathML.

Underline and strikethrough: <u> and <s>

<u> and <s> exist, but both have narrow meanings.

<u> marks text with a non-textual annotation, such as a spelling mistake flagged by a writing tool or a proper name in Chinese text. Browsers underline it β€” which is the problem: people expect underlined text on the web to be a link. Use <u> only when you really need it, and consider styling it differently (for example with a wavy red line).

<s> marks text that is no longer accurate or relevant, shown with a line through it. A sold-out ticket tier or an old price on a sale tag is a good fit:

HTML
<p>Early-bird ticket: <s>$40</s> Sold out</p>
<p>Regular ticket: $55</p>

Avoid underlining for emphasis. Underlined text that is not a link confuses readers. For emphasis, use <em> or <strong>; for decoration, use CSS.

Tracking edits: <ins> and <del>

<s> and <del> look the same, but they are different. <del> marks text that was removed from the document as an edit, and <ins> marks text that was added. Think of a change log, a corrected article or a document showing tracked changes.

Both elements accept two optional attributes:

  • cite β€” a URL to a page explaining the change (it is not displayed).
  • datetime β€” when the change was made, in a machine-readable format such as 2026-10-13 or 2026-10-13T09:30Z. You will learn the full format in Times, Data Values and Ruby Text.
ins and del

The difference in one sentence: <s> says "this is no longer true", <del> says "this was deleted from the document". If you are not recording an edit, <s> is usually the right choice.

Meaning vs appearance

Every default style you saw in this lesson can be changed with CSS. You can make <strong> red instead of bold, or make <mark> a soft blue. The meaning stays the same no matter how it looks. The opposite also holds: if you want a word bold only because it looks nice, give it a class and style it, rather than borrowing an element whose meaning does not fit.

HTML
<style>
  .brand { font-weight: 700; letter-spacing: 0.05em; }
</style>
<p>Welcome to <span class="brand">Lumen Coffee</span>.</p>

You will learn how to write CSS like this in Adding CSS to HTML. Some older tags, such as <big>, <tt> and <font>, only ever described appearance and are now obsolete; see Deprecated and Obsolete Features.

Check your understanding

Quick check Β· 5 questions

of 5 answered You scored / 5 Β· perfect!

  1. 1. A recipe says the dish contains nuts, and readers with allergies must not miss it. Which element fits best?

    <strong> is for important, serious or urgent content such as warnings. <b> only draws attention without adding importance.
  2. 2. Which element is right for the ship name in: The Endurance was trapped in the ice?

    Ship names are a classic use of <i>, which marks text in an alternate voice or a title-like name. <em> would mean you are stressing the word.
  3. 3. A shop lists an old price that no longer applies, next to the new price. Which element should wrap the old price?

    <s> marks content that is no longer accurate. <del> is for recording an edit to the document itself.
  4. 4. How do you write the chemical formula for oxygen gas, Oβ‚‚?

    In chemical formulas, the number sits below the line, so it is a subscript: <sub>.
  5. 5. What does the datetime attribute on <ins> or <del> do?

    datetime is not displayed. It gives software a precise date and time for the edit.

Summary

  • Choose formatting elements by meaning; change their appearance with CSS.
  • <strong> = important; <em> = stressed; <b> = attention without importance; <i> = alternate voice, terms, foreign phrases (add lang).
  • <mark> highlights relevance; <small> holds side comments and fine print.
  • <sub> and <sup> are for formulas, exponents and footnote markers.
  • <s> = no longer accurate; <del> and <ins> record edits, with optional cite and datetime.
  • Avoid <u> for emphasis β€” underlined text looks like a link.

Next: Quotations, Citations and Abbreviations β€” marking up the words of others.