HTML Text Formatting

Formatting Text in HTML

HTML provides various tags to format text. Some tags have semantic meaning (like for important text), while others are purely presentational.

<p><strong>Bold text (important)</strong></p>
<p><b>Bold text (stylistic)</b></p>
<p><em>Italic text (emphasized)</em></p>
<p><i>Italic text (stylistic)</i></p>
<p><mark>Highlighted text</mark></p>
<p><small>Smaller text</small></p>
<p><del>Deleted text</del></p>
<p><ins>Inserted text</ins></p>
<p><sub>Subscript</sub> and <sup>Superscript</sup></p>
  • <strong> - Important text (bold)
  • <em> - Emphasized text (italic)
  • <mark> - Highlighted text
  • <small> - Smaller text
  • <del> - Deleted/strikethrough text
  • <ins> - Inserted/underlined text
  • <sub> - Subscript text
  • <sup> - Superscript text

Try Text Formatting

<h2>Text Formatting Examples</h2>
<p>This is <strong>very important</strong> information!</p>
<p>This text is <em>emphasized</em> for clarity.</p>
<p>The price is <del>$100</del> <ins>$80</ins> today!</p>
<p>H<sub>2</sub>O is water, and E=mc<sup>2</sup> is Einstein's formula.</p>

Note: Prefer semantic tags (, ) over presentational tags (, ) for better accessibility.