WP adds paragraph tags to images (6 posts)

  1. duanelc
    Posted 9 years ago #

    I'm troubleshooting why WP adds paragraph tags to my html code for images. I'm sure others have experienced this, I just can't find any relevant posts on this topic. Could anyone point me in the direction of an explanation for this phenomenon? Site reference: http://www.moonfireandsun.com

    It's frustrating when an application changes or adds to your code without any warning. It causes the pages to fail validation. Much thanks.

  2. whooami
    Posted 9 years ago #

    you are talking about the opening and closing <p> tags around your images?

  3. Because the IMG element is an inline element, not a block element, and it cannot be in the page unless it is inside block level tags.


    <p> Stuff </p>
    <img src="whatever" />
    <p> more stuff </p>

    Is invalid HTML. Has been since at least HTML 4.0. You have to put the IMG inside a P or a DIV or something. It must be inside a block, or it's invalid code.

    The validation error on your page is not that img is inside a p, it's that the p is not closed before the h3 starts. Wrap your imgs in divs or p's to correct the problem.

  4. whooami
    Posted 9 years ago #

    How, specifically, are you adding your images?

    Are you writing the <img src=... into the post textbox? If so, are you using the code tab or the visual tab?

    If you are using the code tab, are you using the image quicktag button?

    Or are you using the the upload function on the posting screen?

  5. whooami
    Posted 9 years ago #

    nm my posts, otto is better :)

  6. duanelc
    Posted 9 years ago #

    Can't believe I missed that one. That indeed fixed it. You guys were a lot of help. Much thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic