SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    code in content of page?

    HI there,

    I want to put some code in to my web pages content. I mean i want to display some code in amongst a paragraph of text.

    Ive never done it before and searched it in google and found the xmp tag, which works but has caused 8 errors on validation against my strict dtd.

    Any ideas how i can do this in a valid way?

    Code:
    <p class="geek"><xmp><geeky rant begins></xmp></p>
    Thanks

  2. #2
    SitePoint Zealot D.D.S. Polymath's Avatar
    Join Date
    Apr 2005
    Location
    Regnvm ServiŠ
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This ought to serve the purpose:

    Code:
    <code>geeky rant here</code>
    A point of reference:

    http://mpt.net.nz/archive/2004/05/02/b-and-i
    Be not too sure that none of the old magic endures...

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Between the opening and closing paragraph tags, enter the following code (the example is just that, an example, and should be replaced with your own code):
    HTML Code:
       <code>This is an &lt;img /&gt; tag.</code>

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    If you want < or > to come out on the page, you have to escape them:
    HTML Code:
    <code>&lt;geeky rant begins&gt;</code>

  5. #5
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats great guys. dont know how i never come accross that before.

    woo-hoo! "This Page Is Valid XHTML 1.0 Strict!"


Bookmarks

Posting Permissions

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