how do I show html code on an html page?

Posted on 2006-04-09
Medium Priority
Last Modified: 2010-04-09
I want to show the actual html for a link.. I thought <code> or <pre> tags would work but they don't. Looking at the source from pages that display code, it seems they replace all the carets with "&lt;" and "&gt;". is that the only way to do it?
Question by:bitt3n

Accepted Solution

JeffHowden earned 500 total points
ID: 16414560
<code> is to display text in a mono-spaced font, but allow for long lines to wrap.  <pre> is to display code exactly as it's found between the opening and closing tags.  The only exception to that statement is that you must convert the angle brackets to their HTML named character entities.

Author Comment

ID: 16414568
OK.. my understanding is that I need to go through my code and selectively change the relevant brackets as I had feared. at least I know what the tags do now. thanks!

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question