WordPress.org

Ready to get started?Download WordPress

Forums

breaking text from wrapping around images? (12 posts)

  1. makwak
    Member
    Posted 9 years ago #

    yes, this is great http://codex.wordpress.org/Wrapping_Text_Around_Images
    However, how do I have some text wrapping around an image, and then stop the next paragraph of text wrapping too?
    Here is an image of the post section:
    http://noplace.mw2mw.com/wp-content/images/breakwrap.gif
    In the first post I use a blank gif the width of the post to break.
    In the 2nd I use a white dot (which apparently doesnt validate)
    The 3rd and 4th post show the problem, the 4th image even extends beyond the post!

    Nothing else I've tried works, any thoughts? If I can find it, I guess I can change the "img" quicktag to path to the blank gif.
    Thanks

  2. Lorelle
    Member
    Posted 9 years ago #

    I'm not sure what you are trying to do. Are you trying to prevent the image from overlapping the second image? And why are you using a "blank.gif" or a dot? These are things that don't quite make sense.

    There is a problem with some browsers that will not recognize the float height within a float and you can find more on this at http://codex.wordpress.org/CSS_Fixing_Browser_Bugs but I'm not sure if that is your issue.

    If you want both images to not crowd or push each other around, align one on the left and one on the right.

    If you want one image to wrap in the first paragraph but NOT have the second paragraph wrap around the first image, then you need to set that paragraph in a DIV or something to section it separately from the rest of the text.

    If you want the second image to be centered, without wrapping, then use the example from the article you noted to use "centered".

    Or better explain what you are doing. And why you are using a blank.gif?

  3. makwak
    Member
    Posted 9 years ago #

    Sorry, and I thought I was being so clear!
    Inside EACH post, I want one image at the top left, with some text on the right. Underneath that I want another image on the bottom left, with more text to the right of that.

    If I don't write enough text, so the wrapping doesnt fill the image, then the 2nd image ends up being wrapped inside the first! Or worse, it bleeds to the post below (maybe I removed too many bits and pieces in the template!

    DIV tags do absolutely nothing to stop this! It may be my template. None of your other suggestions will work either. Maybe I am doing something wrong.

    However, I am very happy, as I never use the Quicktag 'img' (I use the excellent Iimage Browser). So I just went in there and added a url to a blank image that provides me with the formatting that appears so elusive! One click happiness.

    Still under construction but http://noplace.mw2mw.com/ shows what I mean.
    Thanks for your help.

  4. Lorelle
    Member
    Posted 9 years ago #

    Okay, the problem is with the CSS and it's the same one I had with my site. It's mentioned in the Browser bugs article listed above, if I remember.

    Called "Clearfix", it's from Positioniseverything's Easy Clearing. Basically, it's a CSS hack that gives instructions to a float inside of a float as to it's height. Without these instructions, the images will overlap, as your tests show. Using a blank graphic doesn't "fix" the problem it just gives you a temporary solution for that specific instance.

    If you click my name and look at my site you will see on the front page images to the right of each summary. A green bar is on the left of the summary. Without this fix, if the text was short, the image would overlap the post below, causing the stairstep technique you experienced. This is because the container didn't have instructions on how high it was supposed to be to accomodate the floating image inside.

    With this fix, it provides the information and it works. I use a clear:both in the excerpt's style so that each excerpt summary begins "with a clean slate" of no floats above it.

    Here is the code for the style.css:

    .clearfix:after {content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;}
    .clearfix {display: inline-table;}
    /* Hides from IE-mac */
    * html .clearfix {height: 1%;}
    /* End hide from IE-mac */
    /* End clearfix */

    To use it:

    <div class="excerpt-post clearfix">
    <h2 id="post-<?php the_ID(); ?>">......

    You can use two styles in a class, by the way. I also use this in my book reviews and other places where I need to have the image float within the "paragraph" or container and not overlap the one below it.

    On my front page, once this is in my index.php template file, I never have to think about it again. That's nice.

    I hope this helps.

  5. makwak
    Member
    Posted 9 years ago #

    Thanks enormously for you help.
    Actually the code was already in the css style of the template I was using, but not in the index.php main template file at the posting area.
    - I have the clearfix code in the style.css
    - My posted texts are inside a Div class called "storycontent", inside that I made another Div with the class "excerpt-post clearfix", as you say splendidly above?
    - Then if I have two images wrapping inside a post, to stop the second 'stairstep' inside the first, between the two I insert <div style="clear:both;"></div>

    Or is there some way to automate the third step and I have misunderstood?

  6. Lorelle
    Member
    Posted 9 years ago #

    My example of "excerpt-post" was just an example. Use "storycontent" or whatever you want. No need to add another DIV.

    Even with two images inside of a post, I don't have any need for adding the clear:both style anywhere. You can view my style sheet from my website if you are using Firefox with the Web Dev add on (which you SHOULD if you don't! ;-) ).

    I have a customized index.php template file that I've been meaning to write about for some time now, so I'll try to get to that on my site in the next day or two, and that might help you, but you can pull the basics from the source code and CSS on my site now, while you wait.

    The clear:both is in the clearfix as the thing to do "after". So you don't need the div with the clear.

  7. makwak
    Member
    Posted 9 years ago #

    Silly me. Ok, no other DIV.
    With the above, my posts end nicely, but I still get image stepping when I have two images inside a post and the first doesnt have enough text to wrap it.

    O well, will wait until I see your index, perhaps there is something I have missing.
    Actually I continue to like to use the long blank gif as it spaces the text also, and its easy now I have it set up!
    Thanks again

  8. pcmt
    Member
    Posted 9 years ago #

    I'm not sure I've understood the context, but it seems like you need to make sure that a new paragraph clears a floated image in the paragraph above.

    Try adding {clear:both} to your paragraph style.

  9. makwak
    Member
    Posted 9 years ago #

    Wow,
    p {clear:both}
    I put this in the style.css and it actually worked! This with all the other help -

    Thanks!

  10. Lorelle
    Member
    Posted 9 years ago #

    Okay, but what you have just done is made a CLEAR for EVERY paragragh on your site. What about the times when you WANT an image to be wrapped by two paragraphs? I do, all the time.

    The article WITH photos will be out tomorrow morning. I hope that will help make this clear for you.

  11. makwak
    Member
    Posted 9 years ago #

    So there really is no solution then!
    For this site its fine.

    In the end, I think this is because you can only do a carraige return and a new single space between paragraphs, clicking 'enter' three times does nothing. Why? Perhaps there is a way? Its the only future feature that is important to me, as there are dozens of times in my other blogs where I want this.

  12. Lorelle
    Member
    Posted 9 years ago #

    There is a solution.

    If you want a "clear" in every paragraph, and are willing to have large gaps between the end of text and the next paragraph, then the paragraph clear will work.

    The solution will be released in a few minutes on my site.

    Copy the clearfix (as I posted here already) and in the PARENT container that you want to not wrap, add "clearfix", as show" to the classes.

    Don't forget, you can alternate sides (left and right) for the images to float on either side of the paragraphs. I do that all the time.

    I have more than 3000 images on my website right now, and adding more constantly. I have to deal with the challenges of placement of these images daily. Browse around and for the most part, you will see that they work using the methods that have been described to you. I only use the clearfix on the front page and mutiple post pages (not in my single post pages) to create the effect I want with the image and content "locked" into the green bar area of the excerpt.

Topic Closed

This topic has been closed to new replies.

About this Topic