There are specific elements in HTML, which we can use for formatting or defining text with specific meaning.
This is bold text
This is italic text
This is strike-through text
Formatting Elements
<b>
- Bold text<strong>
- Important text<i>
- Italic text<em>
- Emphasized text<s>
- Strike-through Text<del>
- Deleted text<mark>
- Marked text<small>
- Smaller text<ins>
- Inserted text<sub>
- Subscript text<sup>
- Superscript text
Examples:
The <b>
element in HTML is used to define bold text, without any extra importance.
<b>This is a bold text</b>
The <strong>
element in HTML is used to define text with strong importance, which is usually displayed in bold style.
<strong>This is an important text!</strong>
The <i>
element in HTML is used to define a part of text in an alternate voice or mood, which is usually displayed in italics.
<i>This is an italic text</i>
The <em>
element in HTML is used to indicate an emphasized text, which is typically displayed in italics.
<em>This is an emphasized text</em>
The <s>
element in HTML is used to define things that are no longer relevant or no longer accurate, like the old sale price of an item.
<s>This is a strike-through text</s>
The <del>
element in HTML is used to define text that has been removed or deleted from a document, which is typically rendered with a strike through.
<p>I love <del>cricket</del> football.</p>
The <small>
element in HTML is used to define a smaller sized text.
<small>This is a smaller sized text.</small>
The <mark>
element in HTML is used to define a visually marked or highlighted text.
<p>This is a <mark>marked</mark> text.</p>
The <ins>
element in HTML is used to define a newly added text in a document, which is typically rendered with an underline.
<p>I love <del>cricket</del> <ins>football</ins>.</p>
The <sub>
element in HTML is used to define subscript text, which appears half a character below the normal line and typically displayed in a smaller font size. It is commonly used to display chemical formulas.
<p>This chemical formula for water is H<sub>2</sub>O text.</p>
The <sup>
element in HTML is used to define superscript text, which appears half a character above the normal line and typically displayed in a smaller font size. It is commonly used for footnotes or for units like cm3.
<p>One liter is 1,000 cm<sup>3</sup>.</p>
Please check below options for the links to our previous or next tutorial.