HTML Text Formatting

Some tags in HTML are provided for text formatting only. Using these tags, you can control the presentation and position of text on the web page. As you can bold or underline the text.

<!DOCTYPE html>
<html>
<body>

<p><i>Italic text</i></p>
<p><b>Bold text</b></p>
<p><sub> subscript</sub> and <sup>superscript</sup>text</p>

</body>
</html>

HTML Text Formatting Elements

In HTML we can also give special elements which have their own special meaning. You can do this work in a text editor with a button click, but in HTML, you use tags for this. Some common html text formatting types that you apply to text are listed below.

  • <b> element is to bold text.
  • <i> The text is use to make italic.
  • <small> to show short
  • <del> to show deleted
  • <sub> to show the text as a subscript
  • <sup> to show the text as a superscript
  • <ins> to show inserted
  • <strong> If the text is to give more importance then strong element is use.
  • <mark> to show marked

HTML <i> and <em> Elements

<i> element is use to italicize the text.

Example

<!DOCTYPE html>
<html>
<body>

<p><i>This text is italic.</i></p>

</body>
</html>

<em> element is use to emphasize the text.

Example

<!DOCTYPE html>
<html>
<body>

<p><em>This text is emphasized.</em></p>

</body>
</html>

HTML <b> and <strong> Elements

<b> Element text is use to make bold only with no additional value.

Example

<!DOCTYPE html>
<html>
<body>

<p><b>This text is bold.</b></p>

</body>
</html>

<strong> Bold by giving extra importance to the element text. We can use this to make headings bold.

Example

<!DOCTYPE html>
<html>
<body>

<p><strong>This text is strong.</strong></p>

</body>
</html>

HTML <small> Element

<small> element is use to show text smaller

Example

<!DOCTYPE html>
<html>
<body>

<h2>This is <small>Small text</small> in HTML</h2>

</body>
</html>

HTML <del> Element

<del> Used to show element text deleted.

Example

<!DOCTYPE html>
<html>
<body>

<p>My name is <del>Rohan</del> Rohit.</p>

</body>
</html>

HTML <mark> Element

<mark> element text is used to highlited.

Example

<!DOCTYPE html>
<html>
<body>

<h2>My name is <mark>Rohit</mark></h2>

</body>
</html>

HTML <ins> Element

<ins> element text is use to show inserted.

Example

<!DOCTYPE html>
<html>
<body>

<p>My name is <ins>Rohit</ins>.</p>

</body>
</html>

HTML <sub> Element

<sub> element is use for subscript text.

Example

<!DOCTYPE html>
<html>
<body>

<p>My name is <sub>Rohit</sub> .</p>

</body>
</html>

HTML <sup> Element

<sup> element is use for superscript text.

Example

<!DOCTYPE html>
<html>
<body>

<p>My name is <sup>Rohit</sup>.</p>

</body>
</html>