HTML provides a variety of tags that can be used to format and style text. In this article, we’ll explore some of the most commonly used text formatting tags, including the strong
tag, i
tag, em
tag, small
tag, mark
tag, del
tag, ins
tag, sub
tag, and sup
tag.
Strong Tag
The strong
tag is used to indicate text that should be displayed in a bold font. Here’s an example:
css
<p>This text is <strong>bold</strong>.</p>
In this example, the word “bold” is displayed in a bold font.
I Tag
The i
tag is used to indicate text that should be displayed in italic font. Here’s an example:
css
<p>This text is <i>italicized</i>.</p>
In this example, the word “italicized” is displayed in an italic font.
Em Tag
The em
tag is similar to the i
tag in that it is used to indicate text that should be displayed in italic font. However, the em
tag also adds emphasis to the text. Here’s an example:
css
<p>This text is <em>emphasized</em>.</p>
In this example, the word “emphasized” is displayed in an italic font and given additional emphasis.
Small Tag
The small
tag is used to indicate text that should be displayed in a smaller font size than surrounding text. Here’s an example:
php
<p>This text is <small>smaller than surrounding text</small>.</p>
In this example, the text “smaller than surrounding text” is displayed in a smaller font size.
Mark Tag
The mark
tag is used to indicate text that should be highlighted with a colored background. Here’s an example:
css
<p>This text is <mark>highlighted</mark>.</p>
In this example, the word “highlighted” is displayed with a yellow background.
Del Tag
The del
tag is used to indicate text that has been deleted or removed from a document. Here’s an example:
css
<p>This text has been <del>deleted</del>.</p>
In this example, the word “deleted” is displayed with a line through it to indicate that it has been removed.
Ins Tag
The ins
tag is used to indicate text that has been inserted or added to a document. Here’s an example:
css
<p>This text has been <ins>added</ins>.</p>
In this example, the word “added” is displayed with an underline to indicate that it has been inserted.
Sub Tag
The sub
tag is used to indicate subscript text. Here’s an example:
php
<p>This is <sub>subscript</sub> text.</p>
In this example, the word “subscript” is displayed in a smaller font size and positioned below the surrounding text.
Sup Tag
The sup
tag is used to indicate superscript text. Here’s an example:
css
<p>This is <sup>superscript</sup> text.</p>
In this example, the word “superscript” is displayed in a smaller font size and positioned above the surrounding text.
In conclusion, HTML provides a variety of tags that can be used to format and style text. By using tags like strong
, i
, em
, small
, mark
, del
, ins
, sub
, and sup
effectively, you can create visually appealing and easy-to-read content on your website.