Forum Moderators: open
<SNIP>
Basically it is a table with a thead element and repeated tbody elements. Each tbody element starts with a tr containing just one th, which colspans the whole table width.
If I remove all the tbody elements, replacing them with one tbody that envelopes everything not in the thead, it prints fine. However this seems to me to destroy the semantics of the table.
Is this use of tables valid and, secondarily, semantic?
Any other suggestions to make sure this prints?
NB: This has been cross-posted to the WD-L mailing list, but as my email hasn't appeared after 4.5 hours I decided to post here as well. Hope this doesn't work out too annoying.
[edited by: BlobFisk at 3:14 pm (utc) on June 17, 2005]
[edit reason] No URLs please! See TOS [webmasterworld.com] [/edit]
In most cases, you'd want one <thead> and one <tbody>. The <thead> should contain <tr>s with all your <th>s. The <tbody>'s <tr>s should contain <td>s.
Some browsers have special default behaviors for <th>s, and it's possible that what you're seeing is the browser finding and printing what it thinks are column headings, but not finding any content cells in those columns to "push" the table onto the next page and so ending the table.
Using the TBODY multiple times allows you to create "rowgroups". You can then apply TH elements to a rowgroup by having it within the rowgroup, and using the attribute "scope='rowgroup'".
So, my link having been edited to help prevent forum spam [webmasterworld.com] (sorry) here is a simplified version of the table I'm having a problem with:
<table>
<thead>
<tr>
<th>Item</th>
<th>Qty</th>
</tr>
</thead>
<!-- start repeat -->
<tbody>
<tr>
<th colspan="2" scope="rowgroup">Order X, from Customer Y, placed on 16th September</th>
</tr>
<tr>
<th scope="row">An Item</th>
<td>10</td>
</tr>
<tr>
<th scope="row">An Item</th>
<td>5</td>
</tr>
</tbody>
<!-- end repeat -->
</table>