WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to ... multiple paragraphs of text and floated images? (8 posts)

  1. Psylicium
    Member
    Posted 1 year ago #

    Hi there. I have been struggling with this for a couple of hours now, and I don't quite know how to solve it...

    On my page, I want to have photos of 4 persons, each with a description. The photos are floated to the left, so the text wraps around. However, I can't seem to clear the floats, so that each new paragraph starts on a new line, and the following photo gets floated right.

    This is what it looks like now:
    http://i.imgur.com/TT3gV.jpg

    - and this is what I want it to look like:
    http://i.imgur.com/w0gCY.jpg

    I have tried solutions where people suggested to add clearing <div> or <hr /> into the html editor, but the users of this site isn't very tech savvy, so it should be as straight forward as possible.

    My CSS:

    .wp-caption
    	{
    	float: left;
    	background-color: #eeeeee;
    	border: 1px solid #dddddd;
    	font-size: .8em;
    	padding: 5px;
    	margin-right: 10px;
    	}
    
    .wp-caption img
    	{
    	width: 100px;
    	height: 133px;
    	}
    
    .wp-caption p
    	{
    	margin-bottom: 0px;
    	}
    
    .wp-caption-text
    	{
    	border: 1px solid;
    	}
  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Can you post a link to your site where this problem is?

  3. Psylicium
    Member
    Posted 1 year ago #

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    Add a clear left to .wp-caption.

    To then get your desired alignment, you need a html structure whereby you have <div>s surrounding your rows of information.
    E.g

    <div class="wp-caption alignnone" style="width: 85px"><img class="   " title="Animal" alt="" src="http://stilstand.dk/wp-content/uploads/bandpics/bio_animal.jpg" width="75" height="100">
     <p class="wp-caption-text">123</p>
     <p>This is your main text that is aside the image, to the right.</p>
    </div>

    At the moment, the exampled text, "This is your main text" is outside of the closing </div>.

    This is not a WordPress issue, but a general HTML and CSS issue.

  5. Psylicium
    Member
    Posted 1 year ago #

    This is not a WordPress issue, but a general HTML and CSS issue.

    Thanks for your reply, Andrew. I see the problem with the div, but technically it is a WordPress issue, since the <div>s aren't placed as they should be regarding floats. I have tried assigning both the "alignnone" and "alignleft" classes to the images, but the output code is exactly the same. I would assume that if you use the class "alignleft" to the image, WP would throw a clear: left; into the "wp-caption" and enclose the entire paragraph in a <div> (or something like that)...

  6. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    No, WP does not (and should not) add extra styles or HTML. Perhaps a THEME should do that, but that's a different question. If that's a theme you are building, incorporate that structure/styling into your theme.

  7. Psylicium
    Member
    Posted 1 year ago #

    Thank you for the replies. I got it sorted out now. I followed this tutorial, and got rid of the image captions. So far it seems to be working :)

  8. Psylicium
    Member
    Posted 1 year ago #

    Solved.

Topic Closed

This topic has been closed to new replies.

About this Topic