thnkwthprtls
thnkwthprtls

Reputation: 3487

How do I create whitespace between tables?

I have two tables and just need a gap between the two to make it look nicer. How do I do that?

This is how the tables are laid out so far:

<html><body>
  <table><tr><td></td></tr></table>
  <table><tr><td></td></tr></table>
</body></html>

This puts them one right after the other. How do I put a bit of space in between? I'm very new to html so I'm not sure how to add whitespace, the only way I could think of is to create a with a specific id that's nothing but an empty block. However, that seems like it's probably a lot of extra code for something relatively simple.

Upvotes: 0

Views: 145

Answers (2)

Bjorn Smeets
Bjorn Smeets

Reputation: 320

You can create a gap between the two by setting a margin-top on the second table:

<table border=1>
    <tr>
        <td>
            First table
        </td>
    </tr>
</table>
<table border=1 style="margin-top: 15px;">
    <tr>
        <td>
            Second table
        </td>
    </tr>
</table>

Check out this JSFiddle: http://jsfiddle.net/xweYs/

Upvotes: 2

avrahamcool
avrahamcool

Reputation: 14094

give them some margin.

CSS:

table
{
    margin: 10px 0;
}

Upvotes: 4

Related Questions