...

View Full Version : Why does this margin not work ?



jeddi
02-13-2009, 03:32 PM
Hi

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>
</tr>
<?php
while($row = mysql_fetch_assoc($result)){
extract($row);
$pix = "/im/aff_images/$ad_pict";
$cnt = $row['click_cnt'] +1;
echo "
<tr style = \"margin: 40px 0 40px 0 ;\">
<td><b>$rank</b></td>
<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>$data1</td>
<td>$data2</td>
<td>$data3</td>
<td>$data4</td>
<td>$data5</td>
<td><a href=\"/im/linker.php?a=$advert_id&amp;b=$ad_link&amp;c=$cnt\" target=\"_blank\">$ad_name</a></td>
</tr>";
} // end while
?>
</table>

Any ideas ?

jerry62704
02-13-2009, 04: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?

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

I didn't code any collapse, did I?

snowieken
02-15-2009, 12: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