The best way to get multiple columns of text in your table-based design is to drop a nested table into the main content cell, as in Figure 20.1. The nested table can have as many columns as you need, although you probably don't want to use more than two or maybe three. Figure 20.1. Use a nested table in the main content cell of your layout to create multiple columns for text.Normally, when you nest a layout table inside another layout table, you set the border, cellpadding, and cellspacing attributes of the nested table to 0. Doing this makes sure the nested table fits snugly inside its container cell. However, when the layout table holds multiple columns of text, you don't want this effect. Try reading two columns of text sitting next to each other without sufficient whitespace separating them, as in Figure 20.2, and you'll see exactly why. Figure 20.2. You have to plan for whitespace between the columns, or you get something like this.
The cellspacing attribute of the table tag can help you here. Cellspacing controls the amount of space between adjacent cells. Just set the cellspacing attribute to something other than 0, and you get instant whitespace. The exact value depends on the look you're going for, but 12 to 16 pixels are generally sufficient. The layout in Figure 20.3 uses a cellpadding of 12. Figure 20.3. Setting the cellspacing of the table to a value like 12 gives you automatic whitespace.
Listing 20.1. View Source for Figure 20.3.[View full width] <table width="400" border="0" cellpadding="0" cellspacing="12"> <tr> <td width="50%" valign="top"> <p>Reading the text is easier with just a little extra white space between the columns.</p> </td> <td width="50%" valign="top"> <p>This example uses a cellspacing of 12 to create just enough of a visual break.</p> </td> </tr> </table> You want to be sure to do a couple of other things, too:
|