Chapter 31. Floating Inline Images with CSS

As with all design and formatting issues these days, the politically correct method for floating inline images is not by setting the align attribute of the img tag to left or right (see Topic 30), but by using Cascading Style Sheets (CSS). On the plus side, CSS gives you more options than the align attribute does. On the minus side, browsers regularly flake out on CSS wherever they find it, so you need to test your CSS styling in a variety of browsers.

The first step is to float the inline image against a block of text, as in Figure 31.1. As you might guess, the CSS style definition float: left; pushes the image to the left of the text block, while float: right; pushes the image to the right.

Listing ...

Get Web Design Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.