Find us on Facebook

Follow us!

RSS Twitter Facebook LinkedIn

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, please check out the free eBook WordPress 101 Quick Start: Your first site in 2 hours, that will guide you in setting up, adding content and styling a new WordPress website, with video tutorials on using the very powerful Atahualpa theme


Share and comment on Facebook!


9 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>

Notify me of followup comments via e-mail. You can also subscribe without commenting.