Re: [XHTML2][CSS3] Tables: A proposal to support styling by columns

> [Original Message]
> From: Lachlan Hunt <lachlan.hunt@iinet.net.au>
> To: <ernestcline@mindspring.com>
> Cc: W3C HTML List <www-html@w3.org>

(Added back the www-style list as my response also discusses
 the CSS involved.)

> Ernest Cline wrote:
>
> > Example 7
> > <!-- An XHTMLish table -->
> > <table>
> >   <tr><th>1</td><th>2</th><th>3</th></tr>
> >   <tr><th>4</td><td id="a">5<br />8</td><td>6</td></tr>
> >   <tr><th>7</td><tc tref="a" /><td>9</td></tr>
> > </table>
> > 
> > The <tc> element would take but a single attribute tref of type IDREF...
>
>    Ignoring your errors above (and in most of your other examples), such 
> as where you wrote "<th>1</td>", This is a reasonable idea, but it may 
> need some improving.

Well, I started off with all <td>'s in the first example and then decided
that
I wanted a mixture of th and td elements and since I used copy and paste
of example 1, modifying as i went, well.

> Question 1.
>    To write the equivalent of rowspan="3" (or colspan) would you just 
> add additional <tc/> elements with the same tref value?
> eg.
> <table>
>    <tr><th>1</td><th>2</th><th>3</th></tr>
>    <tr><th>4</td><td id="a">5<br />8</td><td>6</td></tr>
>    <tr><th>7</td><tc tref="a" /><td>9</td></tr>
>    <tr><th>10</td><tc tref="a" /><td>12</td></tr>
> </table>

You would also need to supply appropriate styling such as:

#a {rowspan:3}
tc {visibility:hidden}

if instead of presenting it as three separate cells, you wished to
visually represent it as one cell that was three cells high.

> Question 2.
>    What would happen if an author used a <tc/> element with
> a reference to a non-adjacent cell? like this:
> <table>
>    <tr><td id="a">1</td><td>2</td><tc tref="a"/></tr>
> </table>

In the absence of any styling, this would be equivalent to:

<tr><td id="a"></td><td>2</td><td>1</td></tr>

(Assuming I understand how XInclude works, that is.)

It takes styling under my proposal to get the rowspan
or colspan presentation effect.  While the <tc> element
was proposed to make it easy to provide the semantically
equivalent unstyled table to a current table that uses
rowspan and colspan elements, it is not restricted to such
uses.

Note: the styling could be used  to present a table
in a manner that is not consistent with the
semantic content of  the table, such as

<table>
   <tr><th>1</th><th>2</th><th>3</th></tr>
   <tr><th>4</th><td id="a">5<br />8<br />11</td><td>6</td></tr>
   <tr><th>7</th><tc tref="a" /><td>9</td></tr>
   <tr><th>10</th><tc tref="a" /><td>12</td></tr>
</table>

table tr:nth-child(2) > :nth-child(2) {
 rowspan:3; colspan:2
}

This would then look like the current XHTML1 table:

<table>
   <tr><th>1</th><th>2</th><th>3</th></tr>
   <tr><th>4</th><td rowspan="3" colspan="2">5<br />8<br />11</td></tr>
   <tr><th>7</th></tr>
   <tr><th>10</th></tr>
</table>

Trying to save an author from such a "mistake" is not worth
the complications it would cause.  My proposal does give
document authors more rope with which to hang themselves
with, but it also gives the ability to style by columns using CSS
which is something that cannot be done in user agents that 
use the CSS 2 table model if the table has any cells in it with
a rowspan or colspan other than 1.

Received on Monday, 15 December 2003 00:00:43 UTC