Results 1 to 2 of 2

Thread: Here's a Question

  1. #1
    Join Date
    Dec 2007
    Posts
    6

    Here's a Question

    I've seen this done before on other web pages, and I suppose I could find the answer by viewing the source code and sifting through a thousand lines of HTML, but I'd rather just ask someone!

    How can I get HTML code to display as text on a Web page? For example, say I want to give a tutorial on basic HTML, and I want to show someone what a break tag or header tag looks like (so they can copy and paste it to their code), how can I do it without having it function as actual code within MY page? I'd rather not create "images of text" to use because these, for obvious reasons, cannot be ctrl+c'd and ctrl+p'd (plus they're a pain in the butt to work around.)

    There's probably a simple answer, but this is one situation that HTML tutorials generally don't go into (and I've looked).

    Thank you!

    Love, Floppy

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    Characters like < act as code so the html code is operated by the browser and won't show as text in your page.

    Substitute &lt; for < (and perhaps do the same for lots of other characters) and the html code will show as text. See
    http://www.tedmontgomery.com/tutorial/HTMLchrc.html

    So instead of <br> you type &lt;br> or &lt;br&gt; (I usually find that just changing the first character is enough as it disrupts the code as operated by the browser but you should really change them all).
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. A question of content
    By revrandysausage in forum General Questions
    Replies: 0
    Last Post: 26 Sep 2005, 02:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •