Some text formatting tags are already provided in HTML.If it is not necessary, we can use these text formatting tags directly without having to write extra styles, which simplifies our work.
HTML Text Formatting Tags
Popular HTML text formatting tags are:
- <b> – Bold text
- <strong> – Important text
- <i> – Italic text
- <em> – Emphasized text
- <mark> – Marked text
- <small> – Small text
- <del> – Deleted text
- <ins> – Inserted text
- <sub> – Subscript text
- <sup> – Superscript text
The <b> element and the <strong> element
The <b> element defines a bold text:
<b>This is a bold text</b>
The <strong> element not only defines a bold text, but also indicates that this text is important:
<strong>This is a bold text, and it’s very important</strong>
The <i> element and the <em> element
Similar to the difference between the <b> element and the <strong> element, the <i> element defines an italicized text:
<i>This is an italicized text</i>
The <em> element not only defines an italicized text, but also indicates that this text is important:
<em>This is an italicized text and it's very important</em>
The <small> element
The <small> element defines a smaller text:
<h2>HTML <small>Small</small> Formatting</h2>
The <mark> element
The HTML <mark> element defines marked or highlighted text:
<h2>HTML <mark>Marked</mark> Formatting</h2>
The <del> element
The <del> element defines a deleted text:
<p>My favorite food is <del>noodles</del> rice.</p>
The <ins> element
The <ins> element defines an inserted text that is typically used with the <del> element to indicate deletion and updating of the content.
<p>My favorite food is <del>noodles</del> rice <ins>and fruit</ins>.</p>
The <sub> element and the <sup> element
The <sub> element defines a subscript text:
<p>The chemical formula of oxygen is O<sub>2</sub>.</p>
The <sup> element defines a superscript text:
<p>10<sup>2</sup> equals 100.</p>