Horizontal alignment

The align attribute is also used to align an image on the left or right margin of the page by using the values left or right, respectively. What makes left and right alignment special is that, in addition to placing the image on a margin, it allows the text to wrap around it. This is called floating the image. Figure 12-5 shows how images are displayed when set to align to the left and right.

<p><img src="leaf.gif" alt=""align="left" />An Oak and a Reed were arguing
about their strength...</p>
<p><img src="leaf.gif" alt="" align="right" />An Oak and a Reed were arguing
about their strength...</p>

The CSS float property is the preferred method for positioning images (or any element) against the right or left edges of the containing block and allowing the following content to wrap around it. Chapter 21 discusses floating elements.

Get Web Design in a Nutshell, 3rd Edition 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.