HTML Text Formatting

Subject: html

HTML Text Formatting

HTML provides several elements specifically designed to apply stylistic and semantic meaning to text. These formatting elements help structure content visually and contextually, making web pages more accessible and readable.


πŸ“Œ Overview of HTML Text Formatting Tags

HTML formatting tags are used to define how specific portions of text should appear or be interpreted by browsers and assistive technologies. Some tags affect only visual presentation, while others carry semantic importance.


πŸ”Έ Bold and Important Text

1. <b> – Bold Text (Visual Only)

  • Applies bold styling visually, but without semantic importance.

2. <strong> – Strong Importance

  • Both bolds the text and indicates it has strong importance (semantic emphasis).

πŸ”Έ Italic and Emphasized Text

1. <i> – Italic Text (Visual Only)

  • Used for stylistic purposes like technical terms or foreign words.

2. <em> – Emphasized Text

  • Italicizes text and signals emphasis to screen readers.

πŸ”Έ Smaller Text

<small> – Small Text

  • Displays content in a reduced font size.

πŸ”Έ Highlighted Text

<mark> – Highlighted or Marked Text

  • Highlights text (typically with a yellow background).

πŸ”Έ Deleted and Inserted Text

1. <del> – Deleted Content

  • Renders text with a strikethrough to indicate removal.

2. <ins> – Inserted Content

  • Underlines the new text and marks it as inserted.

πŸ”Έ Subscript and Superscript

1. <sub> – Subscript Text

  • Renders text slightly below the normal baseline (e.g., Hβ‚‚O).

2. <sup> – Superscript Text

  • Renders text slightly above the normal line (e.g., xΒ²).

βœ… Key Takeaways

  • Use <strong> and <em> for content that carries semantic importance.
  • Use <b> and <i> for purely visual styling when no semantic meaning is intended.
  • Combine tags for clarity:
  • Avoid using formatting tags for layout or styling onlyβ€”use CSS for visual presentation where possible.

Proper use of these tags helps ensure your website is accessible, readable, and optimized for search engines.