HTML Menu


Text Formatting Tags in HTML


HTML provides following tags to work with text in html documents.

  • <font> tag:

    By using this tag,we can able to change the size and color of the text.

    format :
    <font [size=n] [color="#rrggbb"] > text </font>
  • <b> tag:

    It bolds the text. i.e it is used to display the written text in bold format.

    format :
    <b> some text </b>
  • <strong> tag :

    It bolds the text and it is an advanced version of <b> tag.

    format :
    <strong> some text </strong>
  • <u> tag: It underlines the text.

    format :
    <u> some text </u>
  • <ins> tag:

    It underlines the text and it is an advanced version of <u> tag

    format :
    <ins> some text </ins>
  • <i> tag:

    It italics the text

    format :
    <i> some text </i>
  • <em> tag:

    It italics the text and it is an advanced version of <i> tag.

    format :
    <em> some text </em>
  • <s> tag :

    It strikes the text.

    format :
    <s> some text </s>
  • <del> tag :

    It strikes the text and it is an advanced version of <s> tag.

    format :
    <del> some text </del>
  • <mark> tag :

    It used to highlight a text in HTML.

    format :
    <mark> some text </mark>

Example 1: "text.html"
<html>
<head>
<title>Text</title>
</head>
<body>
<h2>Formatting Text</h2>
font size -7 : <font size="7">HTML</font><br/>
font size-3 : <font size="3">HTML</font><br/>
font color-"red" : <font color="red">HTML</font><br/>
font size-6 and color -red : <font size="6" color="red">HTML</font><br/>
bold,underline and italic : <b><u><i>Text</i></u></b><br/>
Bold :<b>HTML</b><br/>
Strong :<strong>HTML</strong><br/>
Underline :<u>HTML</u><br/>
Ins :<ins>HTML</ins><br/>
Italic :<i>HTML</i><br/>
Emapasis :<em>HTML</em><br/>
Strike :<s>HTML</s><br/>
Del :<del>HTML</del><br/>
Highlighting a text :<mark>HTML</mark>
</body>
</html>

Output:
text
  • <sub> tag :

    It sub scripts the text. Ex: H2O

    format :
    H<sub>2</sub>O
  • <sup> tag :

    It super scripts the text. Ex: a2

    format :
    a<sup>2</sup>

Example 2: "subsup.html"
<html>
<body>
<b>Formula for Water</b> : H<sub>2</sub>O
<br/>
<b>Basic Mathematical Formula</b>
<br/>
(a+b)<sup>2</sup>=a<sup>2</sup>+b<sup>2</sup>+2*a*b
</body>
</html>

Output:
blocks

Character Escape Sequences :
Escapes sequences could be wrongfully interpreted as markup in HTML.so the following characters are reserved in HTML and must be replaced with their corresponding HTML entities:

  • " is replaced with "& quot;"
  • & is replaced with "& amp;"
  • < is replaced with "& lt;"
  • > is replaced with "& gt;"
  • space is replaced with "& nbsp;"



Next Topic :Anchor Tag in HTML