SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Display code snippet as text?

    Hi all

    I've searched a few places though everything points to using a small piece of javascript.
    Hoping this can be solved using CSS.

    How do I render the code between <h1> as text without adding extra tags?

    Code HTML4Strict:
    <h1><tag /></h1>

    Thanks, CB
    The more you learn.... the more you learn there is more to learn.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,168
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by computerbarry View Post
    How do I render the code between <h1> as text without adding extra tags?
    You just replace the code characters with the character references:

    Code:
    <h1>&lt;tag /&gt;</h1>
    That will render as a heading that looks something like this:

    <tag />

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You just replace the code characters with the character references:


    Cheers Ralph works great.
    I was about to write a few lines of JS... ha must be late.
    The more you learn.... the more you learn there is more to learn.


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
  •