Text Formatting in HTML


HTML provides several elements to format text in various ways.

Following are all the primary formatting elements along with brief descriptions.


Formatting Elements

Bold Text (<b>)

Makes text bold without adding any extra importance.

<p>This is <b>bold</b> text.</p>


Strong Text (<strong>)

Makes text bold and indicates that the text is of strong importance.

<p>This is <strong>strong</strong> text.</p>


Italic Text (<i>)

Makes text italic without adding any extra emphasis.

<p>This is <i>italic</i> text.</p>


Emphasized Text (<em>)

Emphasizes text, usually rendering it in italic, indicating stress emphasis.

<p>This is <em>emphasized</em> text.</p>


Marked Text (<mark>)

Makes text smaller.

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


Small Text (<small>)

Makes text smaller

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


Inserted Text (<ins>):

Represents text that has been inserted, usually rendered with an underline.

<p>This is <ins>inserted</ins> text.</p>


Subscript Text (<sub>)

Makes text subscript.

<p>This is <sub>subscript</sub> text.</p>


Superscript Text (<sup>)

Makes text superscript

<p>This is <sup>superscript</sup> text.</p>


Underlined Text (<u>)

Underlines text

<p>This is <u>underlined</u> text.</p>


Code (<code>)

Represents a fragment of computer code.

<p>This is <code>code</code> text.</p>


In Summary

  • <b>: Bold text.
  • <strong>: Strongly emphasized text.
  • <i>: Italic text.
  • <em>: Emphasized text.
  • <mark>: Highlighted text.
  • <small>: Smaller text.
  • <del>: Deleted (strikethrough) text.
  • <ins>: Inserted (underlined) text.
  • Sub<sub>: Subscript text.
  • Sup<sup>: Superscript text.
  • <u>: Underlined text.
  • <code>: Code text.