| Small |
The small tag is written as <small>. The text written inside these tags appears smaller than the normal text. |
| |
| Example |
<p><small> This text will appear small </small></p> |
| Output |
| This text will appear small |
Great care has to be taken while applying these tags in XHTML. It is imperative that the code be created correctly to be operable in XHTML.
WRONG WAY OF USING THESE TAGS |
|
<p><b><i>This site contains jokes</b></i></p> |
|
|
CORRECT WAY OF USING THESE TAGS |
|
<p><b><i>This site contains jokes</i></b></p> |
|
The following example illustrates the use of formatting tags in XHTML:
| Example |
<html> |
|
<head> |
<title> My bag of jokes </title> |
</head> |
|
<body> |
|
<h1> I want to make you laugh</h1> |
|
Hello, this is My Jokes website .<hr/> |
|
<p>Now you will read some rib tickling jokes.<br/> |
<b><i>These jokes are meant for people of all ages. |
Some of them are very good, they will have you in splits.</i></b></p> |
|
<h2>Classic jokes.</h2> |
<p><b> During their silver anniversary, a wife reminded her husband, “Do you remember that when you proposed to me, I was so overwhelmed that I didn't talk for an hour?"<br/> The hubby replied, "Yes, honey, that was the happiest hour of my life."</b></p> |
|
</body> |
</html> |
|
| |
This is how the web page looks:
There are more formatting tags which help in enhancing a web page. With the use of these tags a web page can be made more presentable. Some more formatting tags are discussed below.
| |
| Pharse Tags |
The following tags are all phrase element tags. These tags are applied to provide a richer effect to the web page. These tags are used similarly as HTML. Only the basic rules of XHTML have to be followed. |
| |
| Emphasized Tag |
| |
The emphasized tag is written as <em>. It is used to make a text emphasized. The emphasized text usually appears in Italics. |
| |
| Example |
| <em> This text is emphasized </em> |
| Output |
| This text is emphasized |
Code Tag
The code tag is written as <code>. It indicates that the text written is an example of a typed code. It is usually in a fixed font.
| Example |
| <code> This text is a computer code. </code> |
| Output |
| This text is a computer code. |
Variable Tag
The variable tag is written as <var>. It defines a variable. It means that the text written between these tags is a variable name.
| |
| Example |
| <var> This is a variable </var> |
| Output |
| This is a variable |
Strong Tag
The strong tag is written as <strong>. It is used for stronger emphasis of the text. The text appears to be bold.
| Example |
| <strong> This text is strongly emphasized. </strong> |
| Output |
| This text is strongly emphasized. |
Preformatted Text Tag
The preformatted text tag is written as <pre>. It preserves the preformatted element of the text. The text written in the pre tag will appear in the same way in the web page as in the code. It preserves all the spaces and line breaks.
| Example |
<pre> This is an example of pre tag. </pre> |
|
|
This is an example of pre tag. |
|
The width attribute of the <pre> tag is not supported in XHTML.
|