HTML Text Formatting

HTML contains several elements for defining text with a special meaning.

Bold Text — <b> and <strong>

The <b> tag defines bold text without any extra importance. The <strong> tag defines text with strong importance, and is typically displayed as bold.

HTML
<b>This text is bold.</b>
<strong>This text is strong.</strong>

💡 Tip: Always use <strong> for important text. <b> is just visual — <strong> tells screen readers the text is important.

Italic Text — <i> and <em>

The <i> tag defines a part of text in an alternate voice or mood. The <em> tag defines emphasized text (typically displayed as italic).

HTML
<i>This text is italic.</i>
<em>This text is emphasized.</em>

Small Text — <small>

The <small> tag defines smaller text:

HTML
<small>This is smaller text.</small>

Deleted and Inserted Text

The <del> tag defines text that has been deleted from a document. The <ins> tag defines text that has been inserted into a document.

HTML
<p>My favorite color is <del>blue</del> <ins>red</ins>.</p>

Subscript and Superscript

The <sub> tag defines subscripted text, and the <sup> tag defines superscripted text.

HTML
<p>H<sub>2</sub>O is the chemical formula for water.</p>
<p>E = mc<sup>2</sup> is Einstein's mass-energy equivalence.</p>

Summary of Text Formatting Elements

Element Description Visual Result
<b> Bold Bold
<strong> Strong importance Bold (semantic)
<i> Alternate voice/mood Italic
<em> Emphasis Italic (semantic)
<mark> Highlighted Highlighted
<small> Smaller text Small text
<del> Deleted text Deleted
<ins> Inserted text Underlined
<sub> Subscript Subscript
<sup> Superscript Superscript

Knowledge Check

4 questions — test your understanding

1

What is the difference between <b> and <strong>?

2

What is the difference between <del> and <ins>?

3

When should you use <em> instead of <i>?

4

What does the <mark> element do?

Next: HTML Links