Display Html Tags

We can’t display html tags as it is to get displayed in the browser. Say for example you want to give html code to your visitor to place a link in their web site, pointing to your site. To display html tags in html format we have to use different ways. Browser will not display any thing within less than and greater than symbols. Browser will not display < character as it is. To display symbol < we have to write &lt; , same way to display greater than character > we have to use &gt; . Use the following for displaying the symbols.


<
>
&

"
®
©
&lt;
&gt;
&amp;
&nbsp;
&quot;
&reg;
&copy;
less than
greater than
ampersand
non breaking space
double quote
registered trade mark
copyright

To display the following html code on the browser use the code given below.

Preview
<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
</style>

<script type="text/javascript">
</script>

</head>
<body>

<div></div>

</body>
</html>


Code
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;style type="text/css"&gt;
&lt;/style&gt;

&lt;script type="text/javascript"&gt;
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;


0 comments to "Display Html Tags"

Post a Comment