WordPress.org

Ready to get started?Download WordPress

Forums

New "Image with caption" alignment doesn't work at all (4 posts)

  1. guitavares
    Member
    Posted 7 months ago #

    There is no way I can make text wrap around images inside my posts anymore.
    I know there is a topic about this in the codex, but simply adding those classes to my CSS won't work.
    The problem, as I see it, is that the text is always put inside a <p>, but images with captions are automatically put inside a div. So, the image is never inside the paragraph, causing the html to generate something like this:
    <p>Some text</p>
    <div class="alignleft"> <img /> </div>
    <p>More text</p>

    The image+caption div actually floats to the left or right according to the class. But as it is outside of the <p> elements, the text just won't wrap around the div.

    There will always be a block of text above, an image floated with a blank space beside, and another block of text below.

    Obviously, as the <p> element renders as a rectangle (as everything), it just won't assume an "L" shape to wrap around the div image.

    Now, when you insert an image without captions, it will work because the <img> will be placed inside the <p> together with text, which will wrap around as expected.

    Seems to me this is an bug of latest wordpress versions. Problem is that we have no control on how the DIVs and Ps will organize on the post, since wordpress does it automatically, it is not a theme-layout thing. I can't just find a way to force the <div> inside the <p>.

    Now all my clients websites are screwed up...

    So, any help?!

  2. esmi
    Forum Moderator
    Posted 7 months ago #

    Seems to me this is an bug of latest wordpress versions

    I have not encountered this "bug" in any of my WP sites or themes. so it would seem to be specific to your installs. Specifically the CSS of your theme.

  3. guitavares
    Member
    Posted 7 months ago #

    Does your posts on your WP sites render that way? I mean, with the <div> outside the text <p>?

    Thing is I've been making changes and testing all sort of thing in my CSS for days, and still can't get it to work... well, I'm heading for lunch now and later I can post here more details about this, so we can investigate... thanks anyway!

  4. esmi
    Forum Moderator
    Posted 7 months ago #

    I mean, with the <div> outside the text <p>?

    Not if I use WP to insert images (with or without captions), no. Perhaps it would help if you could post a link to a page demonstrating this problem.

Reply

You must log in to post.

About this Topic