[Wikipedia-l] Table markup

Gutza gutza at moongate.ro
Mon Sep 15 16:33:14 UTC 2003


Magnus Manske wrote:

> Is there a special function for <th> anyway, or is it just the visual 
> difference?

Please note there are two ways of specifying the table headers: TH cells 
(in which case you must specify a scope attribute) and the THEAD row 
group. The THEAD and TBODY groups are mandatory in HTML 4.x strict IIRC 
-- but that's not the reason why I think they should be supported in 
itself. I think they would be interesting to support for the same 
reasons why they have been added to HTML:

1. Separation of content and format by allowing designers to specify the 
content in predefined tags;
2. Accessibility support and special applications support;
3. Greater user agent customization based on the structure information 
(e.g. future browsers will probably render the headers of a table on 
each page the table spans on).

Please note that, should you implement this feature, you'll need to find 
a way to properly retrieve and render the headers in HTML:

<TABLE>
    <TR>
        <TH>Header 1</TH>
        <TH>Header 2</TH>
    </TR>
    <TR>
       <TD>Content 1</TD>
       <TD>Content 2</TD>
    </TR>
</TABLE>

is incorrect, it should be either

<TABLE>
    <TR>
       <TH SCOPE='column'>Header 1</TH>
       <TH SCOPE='column'>Header 2</TH>
    </TR>
    <TR>
       <TD>Content 1</TD>
       <TD>Content 2</TD>
    </TR>
</TABLE>

or ideally

<TABLE>
    <THEAD>
        <TR>
           <TD>Header 1</TH>
           <TD>Header 2</TH>
        </TR>
    </THEAD>
    <TBODY>
        <TR>
           <TD>Content 1</TD>
           <TD>Content 2</TD>
        </TR>
    </TBODY>
</TABLE>

if possible. Also, <TH SCOPE='row'> should be used where it can be 
determined that the contributor wanted to render a vertical header:

<TABLE>
    <TBODY>
        <TR>
           <TH SCOPE='row'>Header 1</TH>
           <TD>Content 1</TD>
        </TR>
        <TR>
           <TH SCOPE='row'>Header 2</TH>
           <TD>Content 2</TD>
        </TR>
    </TBODY>
</TABLE>

Rather than using a CSS class for headers, I'd prefer not using them at 
all, because it would generate the same type of 
structure/content/rendering mix the authors of the HTML specification 
wanted to avoid.

I don't want to impose my notation in your implementation of the markup, 
but I personally find the exclamation mark to be a better solution than 
"|:" exactly because I personally find it to be more intuitive and less 
confusing: it looks similar to the vertical bar, it uses the same 
one-character convention for opening cells as the vertical bar uses and 
the exclamation mark is generally associated with important data, which 
a header in a table is.

Absolutely obviously indubitably just my 2c. :)

Gutza





More information about the Wikipedia-l mailing list