Re: text-align property for columns (once again)

On Fri, Apr 3, 2009 at 6:01 AM, Reg Me Please <regmeplease@gmail.com> wrote:
> Hello.
>
> I've read a number of discussion on the topic, especially the nice
> posting on http://ln.hixie.ch/?start=1070385285 .
>
> I think that whatever is the mechanism used for the width, border,
> background and visibility properties, it can be applied also for the
> text-align.

You started this email saying that you'd read Hixie's post on the
subject.  That post explains perfectly why properties other than the
four that are explicitly listed cannot be applied to <col>s.  There
isn't a "mechanism" that is arbitrarily applied to width, border,
background, and visibility that can just be extended to also work with
text-align.

> Moreover, as table should be used for tabular data presentation, the
> current definition gives more descriptive power to rows over columns.
> Which is an arbitrary decision (possibly driven by a western-centric
> view of text reading/writing: by rows, left to right, top to bottom).
> Accordingly on how tabular data are arranged it can make perfect sense
> to define a style by column rather than by rows.
> Like when you put items or events by row and their properties by column.

...

It's row-centric because that's how the table model works.  HTML
tables have table-rows which are filled with table-cells, and
table-cols are there to give you just a touch of convenience.  The
point here is that cells have *rows* as parents, not columns; elements
can only normally inherit from their parents.  It's possible to define
this away if you're tricky in some cases, but not here, because the
column that something belongs to is defined within the CSS itself.
The information required to *perform* the inheritance isn't available
until *after* inheritance is applied.

It does, of course, make sense to apply properties by column.  And in
fact, you *can* do this if you can accept certain restrictions.  In
the full CSS table model, you don't know what column a cell is in
until after CSS has been resolved.  In the *HTML* table model, though,
you can figure this out during parsing, which happens before CSS
resolution.  So, within the restricted domain of *HTML* tables, you
*can* attach styles to cells based on their column.

There are two good proposals for this right now (and both solve
slightly different problems, so they can coexist).  Both of them are
pseudoclasses which are placed on the cell, and match it if the cell
is in the specified column.  The first is :nth-col().  It should be
obvious how this works - it accepts an "nth" expression like the rest
of the nth properties, so you can do :nth-col(1) or :nth-col(even) or
:nth-col(4n+1).  The second is :col(), which accepts a selector.  It
matches a cell if the provided selector matches the cell's column.
So, frex, :col(.name) would match all table cells in a column with the
class "name".

~TJ

Received on Monday, 6 April 2009 16:29:00 UTC