View Full Version : How to display html for tutorial in html?

05-20-2007, 08:33 PM

I am creating a site where I want users to copy and paste HTML code. This is a regular webpage ( www.techavid.com/internetradiomobile.php ) not a forum. I see here http://www.w3schools.com/html/html_elements.asp that they are doing this, but when I add my code the way they have my code is being displayed not as html text but as the actual html design.


05-20-2007, 08:36 PM
They convert all < to &lt; and all > to &rt; you must do the same if you wish to display your html as text rather than html. Users who copy and paste will receive the correct format they need for html. May want to use a textarea and use the script found here http://www.dynamicdrive.com/dynamicindex11/selectform.htm

05-20-2007, 08:40 PM
You can also try enclosing them in <xmp> </xmp>
However, using <pre></pre> and using the character codes (i.e. &lt; ) is considered better practice.

05-21-2007, 08:40 AM
You can easily do this by Dreamweaver as

1) Copy the required code from the 'code view'
2)Paste it on the 'design view' of the page you wish to display