HTML Formatting

HTML Formatting is a mechanism of formatting text for good look. HTML supply us the capability to format text without using CSS. There are many formatting tags in HTML. These tags are used to make text bold, italicized, or underlined. There are many options available for how text seems in HTML and XHTML.

In HTML the formatting tags are divided into two categories:

  • Physical tag : These tags are used to provide the visual appearance to the text.
  • Logical tag : These tags are used to add some logical or semantic value to the text.

Now we discussed briefly about the HTML Formatting Tags.

Element name Description
<b> This is listed in physical tag and used to bold the text written between it.
<strong> This is listed in logical tag and tells the browser that the text is important.
<i> This is listed in physical tag and used to make text italic.
<em> This is listed in logical tag and used to display content in italic.
<mark> This tag is basicly used to highlight text.
<u> This tag is used to underline text written between it.
<tt> This tag basicly used to appear a text in teletype. (not supported in HTML5 Version)
<sup> It show the content slightly above the normal line.
<sub> It show the content slightly below the normal line.
<big> This tag basicly used for increase the font size by one conventional unit.
<small> This tag basicly used to decrease the font size by one unit from base font size.
<strike> This tag basicly used to draw a strikethrough on a section of text. (not supported in HTML5 Version)
<del> This tag is basicly used to display the deleted content and strikethrough content.
<ins> This tag shows the content which is added

HTML <b> and <strong> Elements

The HTML <b> element listed in physical tag and used to display text in bold font, without any logical importance.

Example :

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

The HTML <strong> tag listed in logical tag and shows the content in bold font and informs the browser about its strong importance.

<p>This text is normal</p>
<strong>This text is important!</strong>
  Try it Yourself

Italic Text

HTML <i> and <em> formatting elements

<i> element is physical element and used to italic the fonts.

Example: 

<p> Normal Text</p>
<p> <i>Italic Text</i></p>
  Try it Yourself

<em> tag is a logical element and it's used to italic fonts with added semantics importance.

Example :

<!DOCTYPE html>  
<html>  
<head>  
    <title>Formatting Elements Example</title>  
</head>  
<body>  
<h1>Example of italic formatting element</h1>  
<p><em>This is an important content</em> This is normal content</p>  
</body>  
</html>
  Try it Yourself

HTML Marked Formatting Tag

<mark> tag is used to highlight a text.

Example : 

<h2>This is sample content <mark> This is marked content .</mark></h2>
  Try it Yourself

Underlined Text

<u> tag is used to underline text.

<p> Normal Text</p>  
<p> <u>Underline Text.</u></p>
  Try it Yourself

Strike Text Tag

<strike> tag is used to displayed the text strikethrough. It is a thin line which cross the statement.

<p> Normal Text</p>  
<p> <strike>Strikethrough Text</strike></p>
  Try it Yourself

Superscript Text Tag

<sup> tag is used to displayed half a character's height above the other characters.

<p>Normal Text <sup>Superscript Text</sup></p>
  Try it Yourself

Subscript Text Tag

<sub> tag is used to displayed half a character's height below the other characters.

<p>Normal Text <sup>Subscript Text</sup></p>
  Try it Yourself

Deleted Text Tag

<del> tag used to show the deleted text.

Example: 

<p>Normal Text <del>Deleted Text</del></p>
  Try it Yourself

Inserted Text Tag

<ins> tag is used to show the inserted text.

Example:

<p>Normal Text <ins>Inserted Text</ins></p>
  Try it Yourself

Larger Text Tag

<big> tag is used to show the one font size larger than the previous one.

Example :

<p>Normal Text <big>Big Text</big></p>
  Try it Yourself

Smaller Text Tag

<small> tag is used to display the one font size smaller than the previous one.

Example :

<p>Normal Text <small>Small Text</small></p>
  Try it Yourself