Text formatting tags are used to change the appearance and importance of text in HTML.
The <b> tag makes the text bold without giving any extra importance.
<b>Bold Text</b>
<p>This is <b>important</b> text.</p>
This is important text.
The <strong> tag shows strong importance and is also bold by default.
<strong>Strong Text</strong>
<p>This is <strong>very important</strong> text.</p>
output:
This is very important text.
The <i> tag makes text italic.
<i>Italic Text</i>
The <em> tag emphasizes text and is important for screen readers.
<em>Emphasized Text</em>
The <u> tag underlines text.
<u>Underlined Text</u>
The <mark> tag highlights text.
<mark>Highlighted Text</mark>
The <small> tag displays smaller text.
x<sup>2</sup>
Output:
x²
H<sub>2</sub>O
Output:
H₂O
| Tag | Purpose |
|---|---|
| <b> | Bold |
| <strong> | Important text |
| <i> | Italic |
| <em> | Emphasis |
| <u> | Underline |
| <mark> | Highlight |
| <small> | Small text |
| <sup> | Superscript |
| <sub> | Subscript |