[css-text] Replacement for text-align: <string>
and solution for numeric column alignment
#10791
Labels
text-align: <string>
and solution for numeric column alignment
#10791
The CSS 2.0 value
<string>
for thetext-align
property has been removed from CSS 2.1 and been punted from CSS Text level 3 to level 4. XSL 1.1 keeps it.Can I Use? data is not available yet, but has been requested. It has never been implemented in browsers as far as I know (except perhaps Presto-based Opera), but at least Antenna House Formatter does support it, while other PDF generators/print processors apparently don't (e.g. PrinceXML, Weasyprint, PDF Reactor, BFO Publisher).
HTML4 had the (optional) presentational attributes
char
andcharoff
for this in cell and column elements (ifalign=char
was set), but the HTML LS omits it (also from alignment notes). I don't know if this was ever implemented anywhere.It definitely is a desirable feature for ergonomics of tabular data, but it seems to be difficult or expensive to implement, so has been gotten shelved for over twenty years.
In #9877, I suggested that the string value could be dropped from
text-align
altogether if there was a CSS way to add leading and trailing invisible zeros to selectable contents (virtually U+2007 Figure Space and U+2008 Punctuation Space as needed). I doubt this could be done withtd::after {content: …}
like leaders.While the current design is basically unimplemented and maybe insufficient, I cannot offer a proposal for a better solution to this problem yet. I think alignment templates as used in spreadsheet applications or cell content type hints could help, but I'm not even sure whether they belonged into HTML or CSS. I actually tend to prefer the former, although a dedicated element type might be better still. But even if the markup included information on the content that helped with its alignment, style authors would likely want to fine-tune or override it, so a CSS solution remains inevitable. A
<string>
longer than a single character could be interpreted as a spreadsheet-like number formatting pattern, e.g.#,##0.0??
, and still remain backward-compatible with CSS2. (I'm not quite proposing that, though.)A new value for the
text-align
property could help with the alignment of table cells. Calledfrom-content
,auto
,numeric
ortabular
, it would horizontally align content likeright
if all applicable characters were numeric, whitespace or punctuation according to their Unicode properties, and likestart
(notleft
!) otherwise. (This would deal well with numbers in most notations, but lacked support for values that contain units.) OpenDocument usestext-align-source: fix | value-type
where the latter keyword triggers the semi-automatic behavior.The text was updated successfully, but these errors were encountered: