HTML Text Formatting
HTML text formatting defines a special meaning of the text. The special HTML elements modify the format of the text.
For example, The HTML elements like <b> and <i> give the output formatting like bold and italic texts.
Check the below examples to know more about HTML text formatting (special type of the text).
Special Elements | Description |
<b> | This tag is used to bold the text. |
<strong> | This tag is used to tell the text is important. |
<i> | This tag is a physical tag which is used to make the text italic. |
<em> | This tag is a logical tag which is used to display the content in italic. |
<small> | This tag is used to make the text in small size (Decrease font size by one unit from base font size) |
<mark> | This tag is used to Marked/Highlighted the text |
<del> | This tag is used to display the deleted text |
<Ins> | It is used to display the content which is added. |
<sub> | It is used to display the content slightly below the normal line. |
<sup> | It is used to display the content slightly above the normal line. |
<strike> | This tag is used to strikethrough the text. (Not supported in HTML5) |
<big> | It is used to increase the font size by one normal unit. |
<u> | This tag is used to underline the text between the content. |
<tt> | It is used to appear in a text in teletype. (Not supported in HTML5) |
Example
<html>
<head>
<title>Html Text Formating</title>
</head>
<body>
<h1>Html Text Formating Example</h1>
<p>This is the <b>bold</b> text</p>
<p>This is the <strong>strong</strong> text</p>
<p>This is the <em> emphasized </em> text</p>
<p>This is the <small>small</small> text</p>
<p>This is the <mark>marked</mark> text</p>
<p>This is the <ins>inserted</ins> text</p>
<p>This is the <sub>subscripted</sub> text</p>
<p>This is the <sup>superscripted</sup> text</p>
<p>This is the <del>deleted</del> text</p>
<p>This is the <big>bigger</big> text</p>
<p>This is the <strike>striked</strike> text</p>
<p>This is the <tt>teletype</tt> text</p>
<p>This is the <i>italic</i> text</p>
<p>This is the <u>underlined</u> text</p>
</body>
</html>
Output:
Notes: The output formatting of <b> and <strong> tags are the same. Likewise, the <i> and <em> tags display the same output format.
But the meaning of these tags are different, that means the <strong> and <em> tags denoted the text are “important”. But the <b> and <i> tags display the output without any extra importance.