HTML Text Formatting

HTML Text Formatting
  • HTML contains several elements for defining text with a special meaning.
HTML Formatting Elements
  • Formatting elements were designed to display special types of text.
  • <i> - Italic text
  • <em> - Emphasized text
  • <b> - Bold text
  • <strong> - Important text
  • <mark> - Marked text
  • <small> - Smaller text
  • <del> - Deleted text
  • <ins> - Inserted text
  • <sub> - Subscript text
  • <sup> - Superscript text
HTML <i> and <em> Elements
  • The HTML <i> element defines a part of text in an alternate voice or mood. The content inside is typically displayed in italic.
  • Note: The <i> tag is often used to indicate a technical term, a phrase from another language, a thought, a ship name, etc.

  • The HTML <em> element defines emphasized text. The content inside is typically displayed in italic.
  • Tip: A screen reader will pronounce the words in <em> with an emphasis, using verbal stress.

  • Example
  • <i>text is italic</i>
    <em>text is emphasized</em>

    Output:

    text is italic
    text is emphasized
HTML <b> and <strong> Elements
  • The HTML <b> element defines bold text, without any extra importance.
  • The HTML <strong> element defines text with strong importance. The content inside is typically displayed in bold.
  • Example

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

Output:

This text is bold
text is strong importance
HTML <mark> Elements
  • >The HTML <mark> tag define text that should be highlighted or marked.
  • Example

<p>This text is <mark>mark</mark> element</p>

Output:

This text is mark element

HTML <small> Elements
  • The HTML <small> tag define small text.
  • Example

<p>This text is <small>mark</small> element</p>

Output:

This text is small element

HTML <del> Elements
  • The HTML <del> element defines text that has been deleted from a document. Browsers will usually strike a line through deleted text.
  • Example

<p>This text is <del>del</del> element</p>

Output:

This text is del element

HTML <ins> Elements
  • The HTML <ins> element defines a text that has been inserted into a document. Browsers will usually underline inserted text.
  • Example

<p>This text is <ins>ins</ins> element</p>

Output:

This text is ins element

HTML <sub> and <sup> Elements
  • The HTML <sub> element defines subscript text.
  • The HTML <sup> element defines superscript text.
  • Example

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

Output:

text is subscript


text is superscript