HTML Text Formatting Tags

HTML provides a variety of text formatting tags that allow developers to control the appearance of text on a web page. Here are some of the most commonly used text formatting tags in HTML:

<b> and <strong> tags:

These tags are used to make text bold. The <strong> tag has a semantic meaning indicating importance, while the <b> tag is purely presentational.

<b>This text is bold.</b>
<strong>This text is also bold and has semantic meaning.</strong>

<i> and <em> tags:

These tags are used to make text italicized. The <em> tag has a semantic meaning indicating emphasis, while the <i> tag is purely presentational.

<i>This text is italicized.</i>
<em>This text is also italicized and has semantic meaning.</em>

<u> tag:

This tag is used to underline text.

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

<s> and <del> tags:

These tags are used to add a strikethrough effect to text. The <del> tag has a semantic meaning indicating deleted text, while the <s> tag is purely presentational.

<s>This text has a strikethrough effect.</s>
<del>This text is also crossed out and has semantic meaning.</del>

<sup> and <sub> tags:

These tags are used to create superscript and subscript text, respectively.

E=mc<sup>2</sup>
H<sub>2</sub>O

<mark> tag:

This tag is used to highlight text with a yellow background, indicating that it is particularly important or relevant.

<mark>This text is highlighted.</mark>

These tags can be combined to create more complex formatting, and can be used in combination with CSS to achieve more advanced styling.