Connect…

RSS Twitter Facebook
YouTube LinkedIn

WordPress How-To

HTML tips: floating image and paragraph/text alignment: starting a new paragraph after a floating image

Image and text alignment are a very frequent source of frustration for website owners.  Unfortunately, mixing text and images in HTML isn’t quite so simple as in Microsoft Word.

A common problem is horizontal alignment of images and / or positioning new paragraphs after a left- or right-floating image.  See for example:


image Here is a floating left-aligned image.  Note that you need to specify either an image class (in WordPress <img class=”alignleft” src=”path-to-the-image” /> or else an <img align=”left” src=”…” /> attribute, along with (normally) an attribute style=”border-right: 5px;” or so  You can do this either in Windows Live Writer or with the WordPress Visual Editor.)

Here is a new paragraph that I want to start after the image.  As you can see it’s not working. I could put in a bunch of line breaks <br/> to make this happen, but the exact number depends on the width of my display and may also depend on the browser.


To accomplish this, you could use tables, of course, but this introduces its own set of problems and is also clunky.  Here is a more elegant solution:  just wrap the new paragraph around a <div style=”clear:both;”> </div>, for example:


image This is my first line
Right before here I have (in HTML) <div style=”clear:both;”>. Notice the new paragraph starts at the bottom of the image. Then I close the </div>.

If you enjoyed this article, did you know that you can access a ton of additional free content, including the eBook WordPress 101 Quick Start: Your first site in 2 hours, by joining this site?
Registration is free and takes 15 seconds.

Do you know you can have a private coaching call with Marc for as little as $30, and sometimes immediately? Consider the benefits of having an expert solve a problem in 5 minutes that might take you frustrating hours of time messing with stylesheets, WordPress options and PHP

5 comments to HTML tips: floating image and paragraph/text alignment: starting a new paragraph after a floating image

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>