W3C home > Mailing lists > Public > www-style@w3.org > November 2006

[CSS3 Text] Issues with text-align='<string>'

From: Arnold Schrijver <arnold.schrijver@logicuse.com>
Date: Mon, 16 Oct 2006 01:12:26 +0000
Message-id: <fc.000f579903414b68000f579903414b68.224a7c3@rotonet.rsdb.nl>
To: www-style@w3.org
In par. 16.2 of the CSS2 specification (http://www.w3.org/TR/REC-CSS2/text.html#propdef-text-align) and in par 17.5.4 (http://www.w3.org/TR/1998/REC-CSS2-19980512/tables.html#column-alignment) the property 'text-align' is described.

IMHO there is a problem with text-align="<string>" as defined here.

In par. 17.5.4 the spec. states: "CSS does not provide a way specify the offset of the vertical alignment axis with respect to the edge of a column box. "
[note that there is also a typo in this line in the spec. It is "...a way to specify...]

This line basically says that it is up to the implementor to decide where to position the <string>-aligned cell values (in the case where <string> is a decimal point) within the column box.

So this leaves an implementor with the provided example in the same paragraph, and a decision has to be made about how to incorporate this feature in their products so that it is most useful to the widest range of customers. In this respect I have to say that even the example is not clear, because it does not show the bounding-box of the column. Are the numbers right-aligned, or are they in the center of the column? Positioning them in the center of the column would already be more intuitive,
because now I have the option to align my column header neatly above the values in that column.

I come to the conclusion that this is a flaw in the specification. The values 'left', 'center' and 'right' for text-align are not mutually exclusive with the value '<string>'. Instead '<string>' can be combined with any of these values. So, the specification should have an additional property 'text-align-string' or something similar. String alignment  setting should then be removed from 'text-align'.

Why is it a flaw, you might say, and not just a bit of freedom for the implementor to choose the desired behavior? It is a flaw IMHO because the implementor would have to create a proprietary metadata property to specify the alignment with respect to the column box.

Without using additional metadata a default behavior that aligns to the left or center of  the column after setting the vertical alignment axis (may also be before, in the case of left alignment) would be much more useful for me (I use writing-mode="ltr"). Of those 2 options alignment to the center would be the better choice, because it provides the best way for positioning the header above the numbers (nicely centered, or aligned to the column edge depending on 'writing-mode' property)

The XSL-FO standard also refers to CSS2 for her 'text-align' specification (http://www.w3.org/TR/xsl/slice7.html#text-align).
I came upon this issue while implementing a XSL-FO application that generates large amounts of documents (contracts and letters) for a large telecom provider in the Netherlands. My XSL-FO Formatter vendor (AntennaHouse) supports text-align="<string>" from version 3.4 of their product XSLFormatter.
The implementation follows the CSS specs exactly (using the example), and thus the values in the column are first right-aligned, and then aligned on the vertical-alignment-axis (or vice versa, which yields the same results).

BTW, I know there is something of a workaround to this problem.
To make it applicable in my application I would have to use the workaround by setting the right margin or padding of the cells, until they are positioned properly below the header (see also: http://lists.w3.org/Archives/Public/www-style/2006Jun/0005).
This is only applicable if I know more or less where the vertical-alignment-axis will be, i.e. when I know the minimum and maximum trailing numbers after the <string>, and still I have no full control over the exact position below my headers, because my vertical-alignment-axis moves depending on location of <string> in respect to all values in that particular column (in the case of many possible trailing characters the range of the axis can be quite wide).

The other option is to right-align the column headers and take for granted that the table formatting will be a bit ugly. In this case I know my customer will not accept this 'ugly-ness'.

I did some further reading into the CSS standards, and interestingly in CSS 2.1 the <string> setting is no longer part of the 'text-align' property (See: http://www.w3.org/TR/CSS21/text.html#propdef-text-align  and par. 17.5.4 in:  http://www.w3.org/TR/CSS21/tables.html#column-alignment)
It was intentionally removed, however the reason for the removal is not stated: http://www.w3.org/TR/CSS21/changes.html#q18

In CSS3 the <string> option is back, but the implementation is the same as in CSS2 (It points back to http://www.w3.org/TR/REC-CSS2/tables.html#column-alignment).

Would an additional 'text-align-string'  property as described above be an option, or does someone know other, maybe better ways to achieve the desired results?

Regards,

Arnold.


Arnold Schrijver
Manager Development & Solutions
LOGIC USE BV (Member of RSDB)
http://www.logicuse.com

Office: Zekeringstraat 40 - 1014 BT - Amsterdam - The Netherlands
P.O. Box 58044 - 1040 HA - Amsterdam - The Netherlands
                                 
Received on Thursday, 9 November 2006 21:01:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:47 GMT