brothercake
03-15-2003, 02:32 PM
I have a data table which is marked up like this:
<table width="80%" cellpadding="0" cellspacing="1" border="1" summary="This table charts responses ... (snip) ">
<caption><abbr title="Question"><span class="abbr" title="Question"><b>Q</b></span></abbr>:
Do you approve or dissapprove ... (snip)</caption>
<thead>
<tr>
<td> </td>
<th class="abbr" abbr="Percent" title="Percent">%</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="2">Base: 985</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Approve</td>
<td>36</td>
</tr>
<tr>
<td>Disapprove</td>
<td>53</td>
</tr>
<tr>
<td>Don't know</td>
<td>12</td>
</tr>
<tr>
<td>Net approve</td>
<td>-17</td>
</tr>
</tbody>
</table>
The table looks like this (http://af.brothercake.com/_tables.html)
The problem is - the TH element has implicit center alignment, but the TD elements do not, therefore if CSS is turned off (and in legacy browsers) the heading is always misaligned with the figures.
How it looks aesthetically isn't so much the issue - it's just that it's confusing like that - particularly when the table becomes complex, but even with this example, I think it's counter-intuititive - for the sake of usability and comprehension, the alignments should be consistent.
So how do I center the TDs (or left-align the TH) ... without CSS or using the align attribute. I want it right without CSS because I want it to work universally; and without the align attribute, because ... well... the page is XHTML 1.1 - if I use align it falls back to 1.0 Transitional :(
Any ideas? Are there any table semantics I can use which are visually interpreted as center alignment on the TDs.
<table width="80%" cellpadding="0" cellspacing="1" border="1" summary="This table charts responses ... (snip) ">
<caption><abbr title="Question"><span class="abbr" title="Question"><b>Q</b></span></abbr>:
Do you approve or dissapprove ... (snip)</caption>
<thead>
<tr>
<td> </td>
<th class="abbr" abbr="Percent" title="Percent">%</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="2">Base: 985</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Approve</td>
<td>36</td>
</tr>
<tr>
<td>Disapprove</td>
<td>53</td>
</tr>
<tr>
<td>Don't know</td>
<td>12</td>
</tr>
<tr>
<td>Net approve</td>
<td>-17</td>
</tr>
</tbody>
</table>
The table looks like this (http://af.brothercake.com/_tables.html)
The problem is - the TH element has implicit center alignment, but the TD elements do not, therefore if CSS is turned off (and in legacy browsers) the heading is always misaligned with the figures.
How it looks aesthetically isn't so much the issue - it's just that it's confusing like that - particularly when the table becomes complex, but even with this example, I think it's counter-intuititive - for the sake of usability and comprehension, the alignments should be consistent.
So how do I center the TDs (or left-align the TH) ... without CSS or using the align attribute. I want it right without CSS because I want it to work universally; and without the align attribute, because ... well... the page is XHTML 1.1 - if I use align it falls back to 1.0 Transitional :(
Any ideas? Are there any table semantics I can use which are visually interpreted as center alignment on the TDs.