This text is bold
This text is italic
This is subscript and superscript
HTML Formatting Elements
when you studied the previous chapter, you came to know about the HTML style attribute.
HTML also has special elements which defines text with a special meaning.
HTML utilises elements like <b> and <i> inorder to format output, like bold or italic text.
Formatting elements were made for displaying special types of text:
HTML <b> and <strong> Elements
The HTML <b> element is used to define bold text, without giving any extra importance.
The HTML <strong> element is used to define strong text, by adding semantic "strong" importance.
HTML <i> and <em> Elements
The HTML <i> element is used to define italic text, without having any extra importance.
The HTML <em> element is used to define emphasized text, by adding semantic importance.
Note: Browsers will be displaying <strong> as <b>, and <em> as <i>. However, there lies a difference between the meaning of these tags: <b> and <i> defines both bold and italic text, but <strong> and <em> refers that the text is "important".
HTML <small> Element
The HTML <small> element is used to define smaller text:
HTML <mark> Element
The HTML <mark> element is used to define marked or highlighted text:
HTML <del> Element
The HTML <del> element is used to define deleted (removed) text.
HTML <ins> Element
The HTML <ins> element is used to define inserted (added) text.
<p>My favorite
<ins>color</ins> is red.</p>
Try it Yourself
HTML <sub> Element
The HTML <sub> element is utilised for defining subscripted text.
<p>This
is <sub>subscripted</sub> text.</p>
Try it Yourself
HTML <sup> Element
The HTML <sup> element is used to define superscripted text.
<p>This
is <sup>superscripted</sup> text.</p>
Try it Yourself
HTML Text Formatting Elements
Tag | Description |
---|---|
<b> | Defines bold text |
<em> | Defines emphasized text |
<i> | Defines italic text |
<small> | Defines smaller text |
<strong> | Defines important text |
<sub> | Defines subscripted text |
<sup> | Defines superscripted text |
<ins> | Defines inserted text |
<del> | Defines deleted text |
<mark> | Defines marked/highlighted text |