Tutorials
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML Text Formatting

Text Formatting

This text is bold

This text is italic

This is subscript and superscript


Try it Yourself

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.

Example

<b>This text is bold</b>
Try it Yourself

The HTML <strong> element is used to define strong text, by adding semantic "strong" importance.

Example

<strong>This text is strong</strong>
Try it Yourself

HTML <i> and <em> Elements

 

The HTML <i> element is used to define italic text, without having any extra importance.

Example

<i>This text is italic</i>
Try it Yourself

The HTML <em> element is used to define emphasized text, by adding semantic importance.

Example

<em>This text is emphasized</em>
Try it Yourself

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:

Example

<h2>HTML <small>Small</small> Formatting</h2>
Try it Yourself

HTML <mark> Element

 

The HTML <mark> element is used to define marked or highlighted text:

Example

<h2>HTML <mark>Marked</mark> Formatting</h2>
Try it Yourself

HTML <del> Element

 

The HTML <del> element is used to define deleted (removed) text.

Example

<p>My favorite color is <del>blue</del> red.</p>
Try it Yourself

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

Test Yourself with Exercises

 

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