Jeremy is right; generally you'll want to use divs in places of tables for layout purposes, but if you're actually displaying a table of information, a table is the best choice, for practical and semantic purposes. For correct use of <th>, you should wrap it in <thead> rather than <tr>. Also, you might find a <tfoot> useful as well (and it might seem silly, but if you use it, it needs to directly follow the <thead> before any other rows are added). For your CSS, you're looking for the border-collapse:collapse; property, which should be applied to the table. See my code example below:
HTML Code:
<style type="text/css">
table {border-collapse:collapse;}
table td, table th {border:1px #000 solid; padding:5px;}
</style>
<table cellpadding="0px" cellspacing="0px">
<thead>
<th>One</th>
<th>Two</th>
<th>Three</th>
<th>Four</th>
</thead>
<tfoot>
<td colspan="4">Footer</td>
</tfoot>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>F</td>
<td>G</td>
<td>H</td>
<td>I</td>
</tr>
</table>
Last edited by VirtuosiMedia; 04-25-2009 at 12:51 AM..
|