HTML Introduction | HTML Text Elements | Text Formatting

HTML provides several tags that apply various effects to text.

Bold text <b> and <strong>

When text needs to be displayed in bold, use the <b> tag, bold text, or the <strong> tag.

<p><b>This sentence is displayed in bold.</b> This is simply a bold part!</p>
<p><strong>This sentence is displayed with emphasis.</strong></p>

Run code

Italic text <i> and <em>

When italic text needs to be displayed, use the <i> tag, italic text, or the <em> tag, emphasized text.

<p><i>This sentence is italic.</i></p>
<p><em>This sentence is emphasized.</em></p>

Run code

Highlighting <mark>

The <mark> tag highlights text.

<p>This part is <mark>highlighted</mark>.</p>

Run code

Insertion <ins>

The <ins> tag, insert, underlines text to make it look as if the text was inserted.

<p>My favorite fruit is <ins>banana</ins> apple.</p>

Run code

Deletion <del>

The <del> tag, delete, draws a line through text to make it look as if the text was deleted.

<p>My favorite fruit is <del>banana</del> apple.</p>

Run code

Superscript <sup>

Use the <sup> tag, superscript, for superscript text.

<p>X<sup>2</sup> + Y<sup>3</sup> = Z</p>

Run code

Subscript <sub>

Use the <sub> tag, subscript, for subscript text.

<p>The chemical formula for water is H<sub>2</sub>O.</p>

Run code