SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: <div> help

  1. #1
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <div> help

    I have this code:

    HTML Code:
    <div><img src="file:///C:/Documents and Settings/NeMewSys/Os meus documentos/As minhas imagens/373231_wood_pattern.jpg"></div>
    And i have this result:

    Why??

    How can i neutralize all HTML code inside the DIV?

    And get this result:
    <img src="file:///C:/Documents and Settings/NeMewSys/Os meus documentos/As minhas imagens/373231_wood_pattern.jpg">

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You replace the characters with special meaning in html with there html reference.
    < will be &lt;
    > will be &gt;

    Code:
    <div>&lt;img src="file:///C:/Documents and Settings/NeMewSys/Os meus documentos/As minhas imagens/373231_wood_pattern.jpg"&gt;</div>

  3. #3
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah!

    So what's the point of using '<div>'??

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No one at all.
    -or-
    I suppose you need a box to have your text inside. A <pre> or <code> would do just as good. I suppose <code> is the 'semantic correct' choose.

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lambda View Post
    So what's the point of using '<div>'??
    The 'point' of using a DIV is to mark up a division of the document.

    If you want display HTML markup, you must escape all special characters ('<' in particular) and you should wrap the fragment in <code>...</code>. If you want to show a multi-line code sample, you can wrap it in <pre>...</pre> to preserve the whitespace. (Note that it should be <pre><code>...</code></pre>.)
    Birnam wood is come to Dunsinane


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
  •