HTML has special tags to give text extra meaning, such as importance or emphasis.
| Tag | Meaning | Looks like |
|---|---|---|
<strong> |
Important text | bold |
<em> |
Emphasised text | italic |
<mark> |
Highlighted text | highlighted |
<small> |
Smaller side note | small |
<del> |
Deleted text | |
<ins> |
Inserted text | underlined |
<sub> |
Subscript | H2O |
<sup> |
Superscript | x2 |
strong vs b, em vs i
<b> and <i> only change the look. <strong> and <em> also tell search engines and screen readers that the text is important — so prefer them.
Example
Example — Formatting tags
HTML
<p>This is <strong>very important</strong> text.</p>
<p>I <em>really</em> like coding.</p>
<p>Don't forget to <mark>submit the form</mark>.</p>
<p>Price: <del>₹999</del> <ins>₹499</ins></p>
<p>Water is H<sub>2</sub>O and 5<sup>2</sup> = 25.</p>
<p><small>Terms and conditions apply.</small></p>