Making text “float” around your images using CSS

The CSS property “float”, when applied to an image will cause that image to -float- over to the left or right side of the conatiner they are within. The text flows around the image as you see in magazines and newspapers.

A simple addition to your stylesheet:

img.floatLeft {
float: left;
margin: 4px;
}
img.floatRight {
float: right;
margin: 4px;
}

Then, set the img tag to use the class:

<img class="floatRight">...

Viola!

Posted under CSS, WebDev

This post was written by Content Curator on October 11, 2006

Tags: , , , , , , , , , , , , , , , ,

Comments are closed.

More Articles: