HTML Text Formatting

Purpose of Text Formatting

Text formatting tags allow you to change the appearance and meaning of text—for emphasis, corrections, highlights, or special notations.

Bold Text

  • <b>: Makes text bold visually
  • <strong>: Marks text as important (semantic)
<b>Bold</b> and <strong>Important</strong>

Italic Text

  • <i>: Italic style
  • <em>: Emphasized text (semantic meaning)
<i>Italic</i> and <em>Emphasized</em>

Underlined and Marked Text

  • <u>: Underlined text
  • <mark>: Highlighted (marked) text
<u>Underline</u> and <mark>Highlighted</mark>

Small, Subscript, Superscript

  • <small>: Smaller font size
  • <sub>: Subscript (e.g., H2O)
  • <sup>: Superscript (e.g., E = mc2)
<small>Note</small>, H<sub>2</sub>O, E = mc<sup>2</sup>

Deleted and Inserted Text

  • <del>: Deleted or removed text
  • <ins>: Inserted or added text
<del>$19.99</del> <ins>$14.99</ins>

Nesting Formatting Tags

Tags can be combined to create layered emphasis, as long as they are nested properly:

<strong><em>This is strong and emphasized.</em></strong>

Practice Prompt

Write a paragraph using at least 5 formatting tags such as <strong>, <em>, <mark>, <del>, and <sup>.

<p><strong>Warning:</strong> This <em>feature</em> is <mark>currently in beta</mark>. It was <del>free</del> but now costs $10<sup>*</sup>.</p>

Need Help?

Ask the AI if you need help understanding or want to dive deeper in any topic