Tutorial 1 - Floating an image to the right

Step 2 - Apply float: right to the image

To force the image over to the right edge, "float: right" is applied to the image using a class selector. In this case, the name of the class is ".floatright" to help illustrate the point, but any name can be used. However, it is better to name classes based on their meaning, rather than their appearance.

No width is needed in this instance as the image has an intrinsic width. If this were a div, a width would have to be used.

Go to Step 3 →

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

.floatright { float: right; }

<img class="floatright" src="images/image.gif" alt="" width="100" height="100">Lorem ipsum dolor sit amet, consectetuer...
Other Max Design articles and presentations
Associated with webstandardsgroup.org