WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Inserting image causes vertical space before H2 heading (3 posts)

  1. Graham Stoney
    Member
    Posted 1 year ago #

    I'm using a fairly simple child of the TwentyTen theme on my site, and I find when I insert a right-justified image, the text only flows down the left side of the image until the next H2. Then a large vertical space is inserted before the next H2. You can see an example here.

    The weird thing is, the Visual post editor displays what I expect: the text continues flowing down the left side of the image with no vertical space. It's only when the post is viewed on the site that it looks ugly.

    Anyone have any clue what might be causing this?

    Thanks,
    Graham

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Heading tags have "clear: both;" CSS assigned here:

    h1, h2, h3, h4, h5, h6 {
        clear: both;
        font-weight: normal;
    }

    This means that they clear any previously floated elements - or start below the element. You could change that in the CSS (might have other problematic effects however) or add a CSS class that would only apply it to certain elements - perhaps something like:

    .noclear {
       clear: none;
    }

    Then assign that class to any headings that you do not want to clear the above floated elements.

  3. Graham Stoney
    Member
    Posted 1 year ago #

    Thanks WPyogi. You're awesome! Problem solved. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic