Display HTML Code on web pages

Heading Tags Info

If you want to display and show HTML code on a web page so that it is not executed, you need to convert the < and > into it's ascii equivalent of &lt; and &gt; this can be very time consuming especially it is a large block of code that you wish to display within a web page tutorial that you are writing.

 

The best way to convert large secions of HTML code is to use the tool below.
All you need to do once you have written your block of code is to copy and paste it into the text box below, after you have done this you then need to click on the 'Convert Code' button. Once done you will see the converted code in the bottom text box, now you can copy the converted text and paste it into your reqired page, when this page is then viewed the text will be displayed as HTML Code.

Tool to Convert HTML Code

Enter the full HTML Code that you wish to Convert into the box below. When you have done that, press the 'Convert Code' button and the conversion will be displayed below it.

 


Here is an Example Conversion

Let us suppose you are trying to explain to someone the HTML code for adding a table into a web page and that code is below:

 

 

<table width="300" border="1" cellpadding="2" cellspacing="2" bgcolor="#ffffff">
<tr valign=top>
<td>
</td>
<td>
</td>
</tr>
<tr valign=top>
<td>
</td>
<td>
</td>
</tr>
</table>

 

 

However, if you just added the code above it would be executed as soon as the page was viewed, which is defeating what you are trying to explain to your visitors, so we need to be able to display the < and > in ascii mode to prevent execution of the code.

What you will need to do is copy and then paste the code into the top box on this page, next, by clicking the "Convert Code" button you will be presented with the code below.

 

 

&lt;table width="300" border="1" cellpadding="2" cellspacing="2" bgcolor="#ffffff"&gt;
&lt;tr valign=top&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=top&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

 

 

You now have the converted HTML which you just copy and paste into your web page, now when the page is viewed you will just see the code which builds the table instead of it being executed.