Skip to main content


Show more

HTML Text Formatting

HTML Text Formatting

  • HTML serves as the backbone of web development, providing numerous elements for text manipulation.
  • Developers can leverage HTML's text formatting elements to create visually captivating and semantically rich content.
  • This guide offers a comprehensive exploration of HTML's text formatting elements, accompanied by code examples and detailed explanations.

HTML Formatting Elements:

Element Description
<b> Bold text
<strong> Important text
<i> Italic text
<em> Emphasized text
<mark> Marked text
<small> Smaller text
<del> Deleted text
<ins> Inserted text
<sub> Subscript text
<sup> Superscript text

1. Bold and Strong Text:

The <b> and <strong> elements are used to render text in bold. While <b> merely denotes boldness without semantic importance, <strong> indicates text of strong importance, often visually presented in bold.

Code Example:

<p><b>This text is bold</b></p>
<p><strong>This text is important!</strong></p>

2. Italic and Emphasized Text:

The <i> element is employed to italicize text, suggesting an alternate voice or mood. Conversely, <em> signifies emphasized text, typically rendered in italics. Screen readers will pronounce <em> content with an emphasis, enhancing accessibility.

Code Example:

<p><i>This text is italic</i></p>
<p><em>This text is emphasized</em></p>

3. Marked, Deleted, and Inserted Text:

  • <mark>: Highlights or marks text for emphasis.
  • <del>: Indicates deleted text, often displayed with a strikethrough.
  • <ins>: Represents inserted text, usually underlined to denote addition.

Code Example:

<p>Do not forget to buy <mark>milk</mark> today.</p>
<p>My favorite color is <del>blue</del> red.</p>
<p>My favorite color is <del>blue</del> <ins>red</ins>.</p>

4. Subscript and Superscript Text:

  • <sub>: Renders text in subscript, useful for mathematical expressions.
  • <sup>: Displays text in superscript, commonly utilized for footnotes or exponentiation.

Code Example:

<p>This is <sub>subscripted</sub> text.</p>
<p>This is <sup>superscripted</sup> text.</p>

5. Small Text:

The <small> element is used to represent smaller text, suitable for disclaimers, footnotes, or copyright statements.

Code Example:

<p><small>This is some smaller text.</small></p>


Understanding and mastering text formatting in HTML is fundamental for crafting visually appealing and semantically meaningful content on the web. By leveraging these text formatting elements, developers can enhance user experience and convey information effectively.

Start integrating these elements into your HTML projects today and unleash the full potential of text formatting in web development!