To wrap text around images in is an essential skill to learn for nice looking HTML page layouts.
There are two common methods explained here for wrapping text around images in HTML: The image attribute method and the table alignment method. You can also use CSS to wrap text around images explained here >>.
The first method called the image attribute method is simplest way to quickly add an image with text wrap.
First you will need to decide on the location you want the image to appear in proximity to your text content. There are things to consider like the overall image size in relation to
the length of a paragraph. In the example I have a short paragraph with small text, so for example purposes I will use an image to match the scale of this example. I have decided to place the image (at the beginning of the paragraph) -- the red X shows where I initially placed the image but I used the image attribute called align to make the image appear to the right. See example 1
Example 1: Image Attribute Method ![]() TIP: You can create your images with a 5 pixel border matching the page background to provide more predictable spacing between images and text or use the table alignment method explained below. |
<img src="panda.gif" width="80" height="80" align="right"> You could also use the following depending on where you want images placed in relation to text. Here are other alignment options: align="left" align="right" align="top" align="middle" align="bottom" align="baseline" align="texttop" align="absmiddle" align="absbottom"
|
Example 2: Table Alignment Method![]() |
The table alignment method contains the image inside its own table at a set width that is the same as the image. The table as a whole is then set to align to the right as the example shows and given some cell padding for a defined border area. The cell padding is key to this approach and gives you flexibiity to create any spacing between text and images you want. The example HTML code is below using cell padding of "5" and table alignment to the right: |