Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,683
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Why does this margin not work ?

    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.

    What have I done wrong ?

    Here is the code :

    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 ?

  • #2
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    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?
    Last edited by jerry62704; 02-13-2009 at 05:59 PM.
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,683
    Thanks
    28
    Thanked 4 Times in 4 Posts
    You do realize that the 40 top would eat the 40 bottom with collapse?
    I didn't code any collapse, did I?

  • #4
    Regular Coder
    Join Date
    Nov 2004
    Location
    The land of chocolate
    Posts
    226
    Thanks
    1
    Thanked 16 Times in 16 Posts
    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.
    -Snow

    Susie, if you want to see your doll again, leave $100 in this envelope by the tree out front. Do NOT call the police. You CANNOT trace us. You CANNOT find us.

    Sincerely,
    - Calvin.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •