|
Posted by Alan J. Flavell on 01/10/01 11:36
On Fri, 6 Jan 2006, Ask Josephsen blurted out, atop a fullquote of
which the salient part seemed to be:
>>> td:first-child + td + td,
>>> td:first-child + td + td + td ,
>>> td:first-child + td + td + td + td {
>>> text-align: right; }
> Thank you for the discussion, very interesting. David, you caught my
> problem nicely "...a table with a hundred rows and ten columns...".
> My tables are rather big and has various needs for aligning each
> column. My wish is to define how each column should align once for
> each table and save as much markup as possible in each row. For this
> the <colgroup> and <col> tags seems to be a fine solution - except
> it does not really work in firefox.
Wrong conclusion. It does not work *in CSS* (the cells are not
descendants of the col/colgroup elements). Firefox is just doing its
job (unlike some browser-like objects that one might mention).
See http://www.w3.org/TR/CSS21/tables.html#q4 to learn just how much
(or how little) can be influenced by styling the col/colgroup
elements.
> The number of columns is fixed (different from table to table
> though) so the stylesheet solution might be a solution.
If most of the cells use a specific alignment then (provided you
define your selectors sufficiently restrictively, e.g as above) you
can define that to be the default alignment for a parent element (tr
or table), and only define a different alignment for those columns
which are exceptions.
It seems to me, on the other hand, that an alternative approach is to
omit the first-child condition, just coding selectors for td, td+td,
td+td+td etc.
There was a discussion in early November which led to these test
documents of mine:
http://ppewww.ph.gla.ac.uk/~flavell/tests/poules.html
http://ppewww.ph.gla.ac.uk/~flavell/tests/poules2.html
and their associated stylesheets. They're just working tests based on
what the original poster had provided - nothing finished or polished,
but they might illustrate what I'm getting at.
In *that* case, if you don't code a selector for column 4, say, then
col.4 is going to match the selector for column 3, rather than
defaulting to the style for the row or table as a whole.
h t h
Navigation:
[Reply to this message]
|