Text Formatting

Make text bold, italic, or emphasized with formatting tags.

Syntax<strong>important</strong> and <em>emphasized</em>

HTML has special elements for formatting text with meaning.

Common formatting elements

  • <strong> — important text (usually bold).
  • <em> — emphasized text (usually italic).
  • <b> — bold text without extra importance.
  • <i> — italic text without extra emphasis.
  • <mark> — highlighted text.
  • <small> — smaller text.

Example

Try it yourself
Loading editor…
Press Run to see the result.

When to use it

  • A developer uses <strong> around a warning message in a help article to signal critical importance to users.
  • An editor uses <del> and <ins> to show what text was removed and added in a changelog document.
  • A teacher wraps a key term in <mark> so students can quickly spot vocabulary words while scanning a tutorial.

More examples

Bold and italic for emphasis

<strong> conveys importance (typically bold); <em> conveys stress emphasis (typically italic).

Example · html
<p><strong>Warning:</strong> Do not close the browser during upload.</p>
<p><em>Note:</em> This feature requires a modern browser.</p>

Mark, del, and ins for edits

<del> shows removed text, <ins> shows added text, and <mark> highlights text for the reader's attention.

Example · html
<p>Price: <del>$99</del> <ins>$49</ins> — limited time offer!</p>
<p>Remember to <mark>submit before midnight</mark>.</p>

Small, sub, and sup tags

<sub> lowers text for chemical formulas, <sup> raises text for exponents, and <small> reduces legal text size.

Example · html
<p>Water formula: H<sub>2</sub>O</p>
<p>Area: 5<sup>2</sup> = 25 cm&sup2;</p>
<p><small>Terms and conditions apply.</small></p>

Discussion

  • Be the first to comment on this lesson.
Text Formatting — HTML | SoundsCode