• Resolved eclark

    (@eclark)


    Hi,

    WP2.5

    I’m just trying to fix my theme to float all images in the posts and pages to the left or right, at this point it doesn’t matter very much, it’s just so annoying I need something. I know this has something to do with floating it with css, and I’ve read the image tutorial on how to very specifically make the changes I want, it appears where physically to place them inside the stylesheet causing me some grief, could someone tell me whereabouts inside the stylesheet this is usually done? I’ve looked at all the image entries, but when I try to put the float code in it messes up my theme.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You probably need to create a new class or classes such as:

    .floatright {float:right;}
    .floatleft {float:left;}

    And put the float specifications in there (along with the appropriate margins — you’ll want some space between the image and the text). Then when you want a specific image to float in one direction you’d have:

    <img src="whatever" class="floatright" />

    If you try to add floats to your existing image styles you’ll end up floating all kind of images that you want to stay put. Which is probably what was happening when your theme was messed up.

    Thread Starter eclark

    (@eclark)

    Thankyou, it was very helpful to finding the ultimate answer and I very much appreciate you answering….Cheers

    So basically for Newbies who may be confused about this… Some themes don’t have all the CSS code you need in them to make stuff happen the way you want. It’s the CSS that controls the look of your site, like fonts, colours, headings, etc. So in the stylesheet file, in your design theme area, you need to create a “class” which is this bit

    }
    .floatright {float:right;}
    .floatleft {float:left;}

    Paste it somewhere in your CSS file…make sure you have the curly braces in there too. This will make your text wrap around your images, instead of sort of sitting on top which looks horrid.
    The current tutorial for this on WordPress, makes it sound like you should add this to the image tags that are already there, which is actually just messing up the images all over your theme. The one’s that were in the theme to start with.
    Then you can modify it and add to it things like padding, which is where there’s a kind of space between your text and your image so it doesn’t kiss the image. Try taking an about.com free course in CSS before you try this, and ask friends for help. Also, try other forums, it’s all far easier that waiting for someone who may never reply on this forum, or getting their cranky reply that you didn’t post something right, or letting them nitpick at your posting for what you wrote or left out. Do I sound a tad bitter? ??

    I’m glad that helped. At the risk of sounding nit-picky — could you mark this resolved? It’s helpful to anyone else who’s searching for the answer to a similar problem.

    Thread Starter eclark

    (@eclark)

    of course ??

    Ok. But, what about RSS readers? How could it be done best way?

    But what if I always want the text to be BELOW my image rather than to the right/left of it.
    Should I remove the float class in my template or is there some way to manage this on a post-by-post basis?

    Thanks.

    rockstyle & rspence — at the risk of seeming picky, do you think it’s a good strategy to post unrelated questions in a thread that has been marked as “resolved”? It doesn’t strike me that you’re likely to get much response that way.

    This has been a HUGE mystery to me for months and I just added that class to my style sheet and I’m up and running. Thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘how to wrap text around images’ is closed to new replies.