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 < (and optionally > with >):
<pre>
<?php echo 'hello world'; ?>
</pre>
As "" tag is deprecated alternatively you can do like this:
<PRE>
<A HREF="http://www.idocs.com">Cool Dude</A>
</PRE>