Discuss Entering a Code Snippet in HTML in the HTML Programming forum on Dev Shed. Entering a Code Snippet in HTML HTML Programming forum covering discussions of HTML and XHTML, as well as HTML-related issues such as writing W3C Compliant code. Use HyperText Markup Language for building websites.
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.
Posts: 3
Time spent in forums: 46 m 54 sec
Reputation Power: 0
New Member - Entering a Code Snippet in HTML
I am setting up a web page that will show code examples when a button is selected.
I am not certain the best way to enter these examples in HTML. I have tried using the code element but when I view the page in the browser it treats the code examples as if they were HTML elements and they do not show.
What is the best way to enter code examples in an HTML document.
Posts: 1,660
Time spent in forums: 2 Weeks 2 Days 2 m 8 sec
Reputation Power: 1642
That should be easy enough to do. All that it takes is making sure that you don't use any special HTML characters like < or > in your code samples. When you do need to use them, make sure that you change them all to their proper HTML equivalent.
Code:
"<" becomes "<"
">" becomes ">"
etc...
Last edited by Catacaustic : February 6th, 2012 at 10:28 PM.
Posts: 3
Time spent in forums: 46 m 54 sec
Reputation Power: 0
Catacaustic
Thanks for the reply. I had already implemented character entities for the couple of pages that I tested on.
I was looking to see if there is a better and quicker way to enter the codes as I have hundreds of pages to setup with the code strings in them.
I may use popups with the code sheets entered as a png graphics file. This way I can keep the color coding, use the special characters and not have to enter all the input by hand. I am still debating how the best way is to enter these.
Posts: 19,134
Time spent in forums: 5 Months 1 Week 6 Days 2 h 38 m 32 sec
Reputation Power: 3755
Welcome to DevShed Forums, Mike001.
Quote:
Originally Posted by Mike001
I may use popups with the code sheets entered as a png graphics file. This way I can keep the color coding, use the special characters and not have to enter all the input by hand. I am still debating how the best way is to enter these.
I was looking to see if there is a better and quicker way to enter the codes as I have hundreds of pages to setup with the code strings in them.
I'd recommend that you use a script to automate the replacement of the special characters with character entities. Here's a script that I wrote for that purpose several years ago: