- HTML contains several elements for defining text with a special meaning.
- Formatting elements were designed to display special types of text.
- <i> - Italic text
- <em> - Emphasized text
- <b> - Bold text
- <strong> - Important text
- <mark> - Marked text
- <small> - Smaller text
- <del> - Deleted text
- <ins> - Inserted text
- <sub> - Subscript text
- <sup> - Superscript text
-
The HTML <i> element defines a part of text in an alternate voice or mood. The content inside is typically
displayed in italic.
Note: The <i> tag is often used to indicate a technical term, a phrase from another language, a thought, a ship name, etc.
- The HTML <em> element defines emphasized text. The content inside is typically displayed in italic.
Tip: A screen reader will pronounce the words in <em> with an emphasis, using verbal stress.
- Example
<i>text is italic</i>
<em>text is emphasized</em>
Output:
text is italic
text is emphasized
- The HTML <b> element defines bold text, without any extra importance.
-
The HTML <strong> element defines text with strong importance. The content inside is typically displayed in
bold.
- Example
<b>This text is bold</b>
<strong>text is strong importance</strong>
Output:
This text is bold
text is strong importance
- >The HTML <mark> tag define text that should be highlighted or marked.
- Example
<p>This text is <mark>mark</mark> element</p>
Output:
This text is mark element
- The HTML <small> tag define small text.
- Example
<p>This text is <small>mark</small> element</p>
Output:
This text is small element
-
The HTML <del> element defines text that has been deleted from a document. Browsers will usually strike a line
through deleted text.
- Example
<p>This text is <del>del</del> element</p>
Output:
-
The HTML <ins> element defines a text that has been inserted into a document. Browsers will usually underline
inserted text.
- Example
<p>This text is <ins>ins</ins> element</p>
Output:
- The HTML <sub> element defines subscript text.
- The HTML <sup> element defines superscript text.
- Example
<p>text is <sub>subscript</sub></p>
<p>text is <sup>superscript</sup></p>
Output:
text is subscript
text is superscript