Text formatting in HTML

HTML contains several tags for formatting text:

  • <b> - Bold text
  • <i> - Italic / Cursive text
  • <strong> - Important text
  • <em> - Emphasized text
  • <mark> - Marked text
  • <small> - Smaller text
  • <del> - Deleted text
  • <ins> - Inserted text
  • <sup> - Superscript text
  • <sub> - Subscript text

Bold and strong text in HTML

HTML Tag <b> defines bold text without any importance. Just bold text.

Bold HTML Tag example

<b>This is bold text</b>

HTML Tag <strong> defines text with more importance, usually displayed as bold text

Strong HTML Tag example

<strong>This is strongtext</strong>

Italic / cursive and emphasized in HTML

HTML Tag <i> defines text as italic or cursive.

Italic HTML Tag example

<i>This is italic text</i>

HTML Tag <em> defines emphasized text usually displayed as italic text.

Emphasize HTML Tag example

<em>This is emphasized text</em>

Subscripted and superscripted text in HTML

HTML Tag <sub> specifies inline text which should be displayed as subscript for solely typographical reasons. Subscripts are typically rendered with a lowered baseline using smaller text. This element can be use for example in chemical formula: H2O.

Subscript HTML Tag example

<sub>This is subscripted text</sub>

HTML Tag <sup> specifies inline text which is to be displayed as superscript for solely typographical reasons. Superscripts are usually rendered with a raised baseline using smaller text. Usually used in mathemtical formulas as example: a2

Superscript HTML Tag example

<sup>This is emphasized text</sup>

By: Tomas Silny
Edited: 2020-11-06 20:14:49
Source: developer.mozilla.org/