Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: using pre tag

  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    137
    Thanks
    1
    Thanked 0 Times in 0 Posts

    using pre tag

    when i want to display code in a page that should not be executed i write that html code inside

    example 1

    <pre>
    <code>
    #div{
    float: left;
    width: 900px;
    height: auto;
    }

    </code>
    </pre>

    this is working fine, however when i write the following code, it is not appearing as code, instead it is being executed.

    example 2

    <pre>
    <code>
    <div id="topmenu">
    <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About Us</a></li>
    <li><a href="#">Contact Us</a></li>
    </ul>
    </div>
    </code>
    </pre>

    the list in this code is being executed, however i want the list code to appear like a code as in example 1

    please advice.

    thanks

  • #2
    Regular Coder
    Join Date
    Jun 2008
    Posts
    173
    Thanks
    2
    Thanked 9 Times in 9 Posts
    replace < with &lt;

    replace > with &gt;

    <ul> should be written as

    Code:
    &lt;ul&gt;

    vineet

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    137
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thanks for letting me know


  •  

    Posting Permissions

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