Hi there, I am looking for a way to display some html code on a web page. Obviously if I just type it in, the browser will not display the code. I know there is a way of doing it but cannot work out how.
I presume you're typing the code, right? If you use a WYSIWYG program, you don't have this problem. An example of such a program is the free Composer that's included with Netscape Communicatior. As far as I know, this is the easiest way to accomplish showing HTML code on a web page.
Surround the code with <code></code>, <xmp></xmp> or <pre></pre> tags. This will make it so the browser displays it as code. <pre> will get you the worst results because IE will format tags inside a <PRE>.
Your other option is to use character encoding for the brackets. Use an & immediately followed (no space) by lt; for < and gt; for >.