A request for the ability to center-justify the text in a tables cells/rows/columns.
This is usually done by adding style="text-align: center;" to either the entire table, or rows, or cells.
Main documentation at https://www.mediawiki.org/wiki/Help:Tables#Attributes_on_tables
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T103276 Provide a way to align/justify the contents of a table cell | |||
Open | None | T54180 Be able to set table cell background (and other formatting options) | |||
Open | None | T176272 Decide on what to recommend for table style usecase |
Event Timeline
Note that there is a request for the table syntax to make it 'easier' to do column/row alignment of table cells T2418: Easier and better alignment within Wiki Tables (but mostly discussed in T2986). Just to point out that this isn't particularly easy, even in wikicode, so any improvement here would probably be very much appreciated by editors.
Yes, I'd rather VE didn't support and encourage the status-quo of using style attributes.
I don't think arbitrary styling is necessary here? Text alignment is pretty easy to figure out with classes that also convey semantic information e.g. <td class="number">. In English, numbers are generally right aligned; normal text is left aligned, dashes and abbreviations are generally centered. Supporting basic classes for certain kinds of information seems entirely reasonable (if we don't support class provision today in VE?).
The main problem here is there are a many ways to set the alignment of a table cell:
- style attribute
- align attribute
- class attribute
- style attribute on the parent row, table, or other container
- class attribute on the parent row, table, or other container
Even if we decide on the cell level style attribute, the editing interface would have to be aware of all the other factors to correctly show the existing alignment. For example the default alignment of <th> is center due to a CSS rule. Further complicating this is that it could vary by skin (although perhaps we can ignore that edge case).
A simpler version would explain in the interface that we are only able to set and read the alignment by the cell's style attribute, and that this may be in conflict with other inherited styles.
Change 787507 had a related patch set uploaded (by Esanders; author: Esanders):
[VisualEditor/VisualEditor@master] [WIP] Set table cell alignment
Change 787510 had a related patch set uploaded (by Esanders; author: Esanders):
[mediawiki/extensions/VisualEditor@master] [PULL THROUGH] Set table cell alignment
Test wiki created on Patch demo by ESanders (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/adfa52d0c8/w/