• Tutorial List

HTML Text Formatting

Last updated Jul 08, 2020
How to change text format in HTML

How to change text format in HTML?

HTML provides several tags to change a text format. Or you can use the CSS to format a text in HTML. But, in this tutorial, you will learn how to change the text format using HTML tags.


Text bold and strong in HTML

  • HTML has two tags to make text bold –
    1. <b>...</b>
    2. <strong>...</strong>
<!DOCTYPE html>
<html>
	<body>

      <p>I'm <b>Bold</b> Text.</p>
      <p>I'm <strong>Strong</strong> Text.</p>

	</body>
</html>

Difference between <strong> and <b> tag

  • Both tags make a text bold.
  • But the <strong> tag indicates that the text has strong importance.
  • And on the other hand, the <b> tag is simply used to make a text bold without giving it any special importance.

Italic text in HTML

  • There are two tags to make a text italic in HTML
    1. <i>...</i>
    2. <em>...</em>
<!DOCTYPE html>
<html>
	<body>

      <p>I'm <i>Italic</i> Text.</p>
      <p>I'm <em>Emphasized</em> Text.</p>

	</body>
</html>

Difference between <i> and <em> tag

  • Both tags make the text italic.
  • But the <em> tag indicates that the text has stress emphasis.
  • And the <i> tag is simply used to make a text italic without added semantic importance.

Highlight text in HTML

The <mark> tag is used to highlight a text in HTML –

<!DOCTYPE html>
<html>
	<body>

      <p>I'm a <mark>Highlighted</mark> Text.</p>

	</body>
</html>

Inserted text in HTML

The <ins> tag is used to define that it is an inserted text –

<!DOCTYPE html>
<html>
	<body>

      <p>It is an <ins>Inserted</ins> Text.</p>

	</body>
</html>

Deleted text in HTML

The <del> tag is used to define that it is a removed or deleted text –

<!DOCTYPE html>
<html>
	<body>

      <p>It is a <del>Deleted</del> Text.</p>

	</body>
</html>

Small Text in HTML

The <small> tag is used to make a text smaller than surround text.

<!DOCTYPE html>
<html>
	<body>
      
      <h1>HTML <small>Small</small> Tag</h1>
      <p>I'm a <small>Small</small> Text.</p>

	</body>
</html>

Superscript and Subscript text in HTML

  • <sup>
    • This tag is used to define superscripted text.
    • The superscripted text displayed slightly above than the surrounding text.
  • <sub>
    • This tag is used to define subscripted text.
    • The subscripted text is displayed slightly down than the surrounding text.
<!DOCTYPE html>
<html>
	<body>
      
      <p>4<sup>2</sup> could be called 4 to the power 2.</p>
      <p>H<sub>2</sub>O is the chemical formula for water.</p>

	</body>
</html>

Ask Questions

Your email address will not be published. Required fields are marked *