View Full Version : Why does this margin not work ?

02-13-2009, 04:32 PM

I have a table of data and I want to have a gap between each row.

So I se the above and below margins of the rows to 40px.

But all the rows are tightly together. :confused:

What have I done wrong ?

Here is the code :

<table summary="web hosts" width="800px">
<tr style = \"margin: 40px 0 40px 0 ;\">
<th> </th><th>Host</th><th>Special Price</th><th>12 Month</th><th>Domains</th><th>Space</th><th>Free Domains</th><th>Full Details</th>
while($row = mysql_fetch_assoc($result)){
$pix = "/im/aff_images/$ad_pict";
$cnt = $row['click_cnt'] +1;
echo "
<tr style = \"margin: 40px 0 40px 0 ;\">
<td><a href=\"/im/linker.php?a=$advert_id&amp;b=$ad_link&amp;c=$cnt\" target=\"_blank\"><img src=\"$pix\" alt='Host Logo'height='34' width='150' border=0></a></td>
<td><a href=\"/im/linker.php?a=$advert_id&amp;b=$ad_link&amp;c=$cnt\" target=\"_blank\">$ad_name</a></td>
} // end while

Any ideas ?

02-13-2009, 05:48 PM
Try this in your css:
td {padding-bottom: 40px;}

I don't think you need to escape the quote in the <tr> as it isn't part of the PHP. You do realize that the 40 top would eat the 40 bottom with collapse?

02-15-2009, 01:20 PM
You do realize that the 40 top would eat the 40 bottom with collapse?

I didn't code any collapse, did I?

02-15-2009, 01:38 PM
Margins don't work on a table row, you need to do a workaround with your table cells somehow to achieve the desired effect. That, or cellspacing/cellpadding in your table - but this goes for the entire table then, which is probably not your intention.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum