Closing paragraph tags being ingnored

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KeredDrahcir
    Contributor
    • Nov 2009
    • 426

    Closing paragraph tags being ingnored

    I'm wondering if anyone can help me. I'm getting validation errors where I'm told I'm trying to open a div inside a paragrpah.
    I'm closing the paragrpah before I open the div but for some reason the validator doesn't see the closing p tag ans when I view source, the browser doesn't see it.
    It's quite definatly in the code.
    Code:
    <div class="[I]my class[/I]">
      <p style="text-align: center;">
        <br />
        <a href="javascript:void(0)" onclick = "[I]my script[/I]">
          <img width="225" height="228" src="[I]my image[/I]" alt="" />
        </a></p>
    <div style="position: fixed; top:50px; left: 25%;">[I]My content[/I]</div></div>
    That is my code but the closing p tag after the closing a tag goes missing. It does it more than once.
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Which browser? That should validate so it depends on what's going on before that.

    I wouldn't be using XHTML self closing tags like <br /> or <img/> in HTML markup cause it's unnecessary and sometimes leads to problems.

    Comment

    • KeredDrahcir
      Contributor
      • Nov 2009
      • 426

      #3
      I need to use the self-closing tags because I'm using XHTML. I know that the code should validate but the browser missed out the closing paragraph tag. I get it in Internet Explorer, Firefox, Safari, Google Chrome and Opera.

      I did fix it using a division instead of a paragraph but I don't want to have to that every time and would like to know why it happens. Any other ideas?

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        the browser missed out the closing paragraph tag. I get it in Internet Explorer, Firefox, Safari, Google Chrome and Opera.
        Sounds like you're contradicting yourself. I don't see the problem.

        Comment

        • KeredDrahcir
          Contributor
          • Nov 2009
          • 426

          #5
          I meant I get the problem.

          This is my code:
          Code:
              <div class="my class">
                <p style="text-align: center;">
                  <br />
                  <a href="javascript:void(0)" onclick = "my script">
                    <img width="225" height="228" src="my image" alt="" />
                  </a></p>
              <div style="position: fixed; top:50px; left: 25%;">My content</div></div>
          This is what the browser shows:
          Code:
              <div class="my class">
                <p style="text-align: center;">
                  <br />
                  <a href="javascript:void(0)" onclick = "my script">
                    <img width="225" height="228" src="my image" alt="" />
                  </a>
              <div style="position: fixed; top:50px; left: 25%;">My content</div></div>
          Notice the difference on the second to last line.

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            I just don't see that. Perhaps your script is doing something?

            Comment

            • KeredDrahcir
              Contributor
              • Nov 2009
              • 426

              #7
              Do you notice that the closing paragrpah tag afer the closing anchor is missing in the second piece of code?
              If you're asking if the onclick script is affect it, then I can be sure that it isn't all it does it changes the display values of two divisions.

              Comment

              • drhowarddrfine
                Recognized Expert Expert
                • Sep 2006
                • 7434

                #8
                Yes I saw that but I don't see the problem in any browsers myself.

                Comment

                • KeredDrahcir
                  Contributor
                  • Nov 2009
                  • 426

                  #9
                  So you have no idea what's causing it for me? Is that correct?

                  Comment

                  • drhowarddrfine
                    Recognized Expert Expert
                    • Sep 2006
                    • 7434

                    #10
                    Yep .

                    Comment

                    • KeredDrahcir
                      Contributor
                      • Nov 2009
                      • 426

                      #11
                      Thanks. I'll let you know if I sort it.

                      Comment

                      Working...