Jump to content

Community Wishlist Survey 2022/Editing/Formatting columns in table

From Meta, a Wikimedia project coordination wiki

Formatting columns in table

  • Problem: When editing a table in wikitext, it is possible to add CSS properties to rows and to cells, but not to columns. When a property applies to an entire column, we are compelled to copy-paste this property in every cell of the column; it would be easier and shorter to write it only once, at the beginning of the column.
  • Proposed solution: Enable in some way the use of the <colgroup> and <col> HTML attributes within {| |}.
  • Who would benefit: Contributors who create or edit tables on any Wiki project.
  • More comments:
  • Phabricator tickets: phab:T2986, phab:T103276
  • Proposer: ElioPrrl (talk) 16:27, 11 January 2022 (UTC)[reply]

Discussion

  • I can see this as being useful for centering a column of flags (images) or right aligning a numeric column, but my tests on Windows 10 (Chrome, Edge, Firefox) browsers showed that the "text-align" style on the colgroup's col didn't work. I found some other styles didn't work too like "font-weight". It needs more browser support to be effective. Jroberson108 (talk) 10:43, 30 January 2022 (UTC)[reply]
    Browser support can improve in the future, but what surely can be done right now is to modify the wiki engine to parse these attributes and just duplicate them in each cell of corresponding columns. This will of course bloat the output HTML compared to native col (if it were working...), but no more that current manual insertion of all this stuff, and it will greatly relieve us of doing such manual insertions. Maybe this can be optimized by properly defining and automatically using CSS classes. — Mikhail Ryazanov (talk) 23:33, 4 February 2022 (UTC)[reply]
  • A mostly numeric table can be right-aligned as a whole. But there are usually also 1 or more columns that need to be left aligned. style=text-align:left has to be added to every cell in those columns. I can usually find a mass find-and-replace method to do that, but it can be difficult. It would be nice if the Visual Editor could do that to selected columns. --Timeshifter (talk) 14:31, 31 January 2022 (UTC)[reply]
  • And please add an option for decimal point alignment. Current "solutions" are even more painful than plain left/right/center override. — Mikhail Ryazanov (talk) 20:04, 4 February 2022 (UTC)[reply]
  • Note that <col> explicitly doesn't support text alignment properties or anything that requires styling the cell itself. It would only be useful for setting the background colour. ESanders (WMF) (talk) 16:33, 29 April 2022 (UTC)[reply]

Voting