HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

HTML Text Formatting

HTML provides special tags to format text — to make it bold, italic, underlined, and more. These tags give text meaning and visual style.


Bold Text — <b> and <strong>

Both tags make text bold, but they have different semantic meanings:

<b>This text is bold (no extra meaning).</b>
<strong>This text is important (semantic bold).</strong>
This text is bold (no extra meaning).
This text is important (semantic bold).
TagMeaningRendered As
<b>Bold — visual only, no semantic meaningBold text
<strong>Strong importance — screen readers emphasize thisStrong text

Italic Text — <i> and <em>

<i>This text is italic (visual only).</i>
<em>This text is emphasized (semantic italic).</em>
This text is italic (visual only).
This text is emphasized (semantic italic).
TagMeaningRendered As
<i>Italic — visual only (e.g. technical terms)Italic text
<em>Emphasis — screen readers stress this wordEmphasized text

Underlined Text — <u>

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

Strikethrough Text — <s> and <del>

<s>This text is no longer accurate.</s>
<del>This text has been deleted.</del>
This text is no longer accurate.
This text has been deleted.

Inserted Text — <ins>

The <ins> tag marks text that has been inserted into a document (shown with underline):

<p>My favorite color is <del>blue</del> <ins>red</ins>.</p>

My favorite color is blue red.


Highlighted Text — <mark>

<p>Do not forget to <mark>buy milk</mark> today.</p>

Do not forget to buy milk today.


Superscript — <sup>

Superscript text appears half a character above the normal line — used for footnotes, exponents, ordinals:

<p>2<sup>10</sup> = 1024</p>
<p>The 1<sup>st</sup> of January</p>

210 = 1024

The 1st of January


Subscript — <sub>

Subscript text appears half a character below the normal line — used in chemical formulas:

<p>H<sub>2</sub>O (Water)</p>
<p>CO<sub>2</sub> (Carbon Dioxide)</p>

H2O (Water)

CO2 (Carbon Dioxide)


Small Text — <small>

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

Normal text. This is small text.


Quick Reference — All Formatting Tags

Tag Description Example Output
<b>Bold (visual)Bold
<strong>Important/bold (semantic)Strong
<i>Italic (visual)Italic
<em>Emphasized/italic (semantic)Emphasised
<u>UnderlineUnderline
<s>Strikethrough (inaccurate)Strikethrough
<del>Deleted textDeleted
<ins>Inserted textInserted
<mark>Highlighted textHighlighted
<sup>Superscript210
<sub>SubscriptH2O
<small>Smaller textSmall text
Best Practice: Prefer <strong> over <b> and <em> over <i> — they carry semantic meaning that helps screen readers and search engines understand your content.