how do I show html code on an html page?

Posted on 2006-04-09
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
    LVL 7

    Accepted Solution

    <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

    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!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now