在html页面中显示html代码

Am using this following method to display html code in html page

 <?php $userSuppliedHTML = "<div>snaoj</div>"; ?>
 <code><?php echo htmlentities($userSuppliedHTML, ENT_QUOTES, 'UTF-8'); ?></code>    

Since my page are html so i can't run above method because its php

so i decide to use this following method based on only html

        <blockquote>
            <pre>
             <code>
               <div>snaoj</div>
                My pre-formatted "quoted" code here.
              </code>
            </pre>
        </blockquote>

pre{
                font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
                margin-bottom: 10px;
                overflow: auto;
                width: auto;
                padding: 5px;
                background-color: #eee;
                width: 650px;
                padding-bottom: 20px;
                max-height: 600px;
            }

Problem is this method doesn't

can some one help me how do i display codes on web pages

Ideas on how to display/present HTML tags on a webpage

Use the <xmp> tag instead of <pre>.

<xmp>
<html>
<body>This is my html inside html.</body>
</html>
</xmp>

You can use highlight_string() php function to display php code

<?php
highlight_string('<?php phpinfo(); ?>');
?>

Replace all occurences of < with &lt; (and optionally > with &gt;):

<pre>
&lt;?php echo 'hello world'; ?&gt;
</pre>

As "" tag is deprecated alternatively you can do like this:

<PRE>
&#60;A HREF="http://www.idocs.com"&#62;Cool Dude&#60;/A&#62;
</PRE>

Reff:http://www.htmlcodetutorial.com/_XMP.html