HTML Formatting

HTML text formatting elements are used to give text semantic meaning and visual emphasis, such as importance, emphasis, highlights, and annotations.

On this page

HTML Text Formatting

HTML includes elements that give text special meaning, such as emphasis, importance, or visual distinction.

Example

<strong>This text stands out</strong>
<em>This text is emphasized</em>
Water is H<sub>2</sub>O and 10<sup>2</sup> is one hundred.

HTML Formatting Elements

Formatting elements are used to mark text with a specific meaning or role.

  • <b> – Bold text
  • <strong> – Important text
  • <i> – Alternate voice or mood
  • <em> – Emphasized text
  • <mark> – Highlighted text
  • <small> – Smaller text
  • <del> – Deleted text
  • <ins> – Inserted text
  • <sub> – Subscript text
  • <sup> – Superscript text

Bold and Important Text

The <b> element makes text bold without adding meaning. The <strong> element indicates importance.

<b>Bold without emphasis</b>
<strong>Important message</strong>

Italic and Emphasized Text

The <i> element represents an alternate voice. The <em> element adds emphasis that can be recognized by assistive technologies.

<i>Technical term</i>
<em>Pay attention to this</em>

Small and Marked Text

Some elements adjust size or visually highlight text.

<small>Fine print text</small>
Please review the <mark>important</mark> section.

Inserted and Deleted Text

These elements are often used to show changes in content.

The price was <del>$50</del> <ins>$40</ins>.

Subscript and Superscript

Subscript and superscript text are commonly used in formulas and references.

CO<sub>2</sub> is a gas.
See note<sup>1</sup> for details.

Formatting Reference

Tag Description
<b>Bold text
<strong>Important text
<i>Alternate voice or mood
<em>Emphasized text
<small>Smaller text
<mark>Highlighted text
<del>Deleted text
<ins>Inserted text
<sub>Subscript text
<sup>Superscript text

HTML Formatting Examples (10)