[thelist] Text inside tables

Michael Mell mike at nthwave.net
Thu Jul 11 14:11:01 CDT 2002


Steve Lewis wrote:

> carlos moreno wrote:
>
> >  I need to put text and gifs inside TD's within a fixed width
>  > table (in pixels 775 px.). When the total width of all elements
>  > exceeds 775px  the table is "autoenlarged",

<tip type="table flow" author="mike at nthwave.net">
When you want specific widths of table cells,
1) specify the width of the table, and
2) specify the width of each cell and
3) include an image that spans the entire width of the cell within each
cell,
    either as a visible image or a spacer gif.
4) specify  hspace="0" vspace="0" border="0" for the images in #3
5) leave the closing cell tag </td> on the same line as the last bit of
content for that cell

Be sure your widths are correct -- the total of each row should equal the
total table width

It is easiest to use cellpadding="0" cellspacing="0" border="0" for doing
the math, but if you use other values here, take them into account when
specifiying the cell widths.

These steps will usually guarantee a well-beheved table in all browsers.

for example:

<table cellpadding="0" cellspacing="0" border="0">

<tr>
<td width="100">
 <img src="spacer.gif" width="100" height="2" hspace="0" vspace="0"
border="0" alt=""></td>

<td width="100">
 <img src="spacer.gif" width="100" height="2" hspace="0" vspace="0"
border="0" alt=""></td>
</tr>

<tr>
<td width="200" colspan="2">
 <img src="spacer.gif" width="200" height="2" hspace="0" vspace="0"
border="0" alt=""></td>
</tr>

</table>


</tip>



--
mike[at]nthwave.net
llemekim         YahooIM
415.455.8812     voice
419.735.1167     fax





More information about the thelist mailing list