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 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2012
    Location
    Ohio, United States
    Posts
    14
    Thanks
    3
    Thanked 1 Time in 1 Post

    Exclamation Help with table spacing!

    I'm trying to put space in between each row of my table, but I can't out of to do it. This is the page: http://nickriggi.com/workwanted/

    Code:
    <table align="center" border="1" cellspacing="1" cellpadding="1">
    	<tr>
    		<th width="10%">Posted</th>
    		<th width="20%">Title</th>
    		<th width="20%">Location</th>
    		<th>User</th>
    	</tr>
            <?php
    		$result = mysqli_query($cnx, "SELECT * FROM jobs ORDER BY id DESC");
    		while($row = mysqli_fetch_array($result)){
    			echo("<tr><td>".$row['date']."</td><td>".$row['title']."</td><td>".ucfirst($row['city']).",&nbsp;".$row['state']."<td>".ucfirst($row['username'])."</td></tr>");
    		}
    		mysqli_free_result($result);
    	?>
    </table>

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    You cannot.

    A table is a table. There are no spaces between rows in a table.

    You can wrap the <tr>'s in <tbody>'s and use margin-bottom on them.

    Code:
    <table align="center" border="1" cellspacing="1" cellpadding="1">
        <tbody style="margin-bottom:20px;">
             <tr>
                 <th>Month</th>
                 <th>Savings</th>
             </tr>
        </tbody>
        <tbody style="margin-bottom:20px;">
             <tr>
                 <th>Month</th>
                 <th>Savings</th>
             </tr>
        </tbody>
    </table>
    Last edited by Sammy12; 09-08-2012 at 01:24 AM.

  • #3
    New Coder
    Join Date
    Sep 2012
    Location
    Ohio, United States
    Posts
    14
    Thanks
    3
    Thanked 1 Time in 1 Post
    Can I add an <hr /> tag in between each row? I can just take the border away and do that then, if there is a way.


  •  

    Posting Permissions

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