Formatting Text

Learn how to format text in HTML

HTML Text Formatting

HTML provides several elements for formatting text. Here are some of the most commonly used ones:

Bold Text

To make text bold, use the <b> or <strong> tag:

<b>This text is bold</b>
<strong>This text is also bold</strong>

Italic Text

To italicize text, use the <i> or <em> tag:

<i>This text is italic</i>
<em>This text is also italic</em>

Underlined Text

To underline text, use the <u> tag:

<u>This text is underlined</u>

Strikethrough Text

To strike through text, use the <s> tag:

<s>This text is strikethrough</s>

Superscript and Subscript

For superscript, use <sup>. For subscript, use <sub>:

This is <sup>superscript</sup> text
This is <sub>subscript</sub> text

Highlighted Text

To highlight text, use the <mark> tag:

<mark>This text is highlighted</mark>