Skip to content

[css-tables] Allow 'order' on table columns #7340

@fantasai

Description

@fantasai

Posted in https://lists.w3.org/Archives/Public/www-style/2022Jun/0005.html :

I recently wondered why the order property only exists for flexbox and grid. Imo it makes a lot of sense for the table element as well. Sometimes you want to reorder columns and other is no convenient way to do so besides changing the whole dom structure.

Adding an order property to td would tackle that issue. An obvious problem is that you can easily create conflicts by setting different orders for tds of the same column. That's why the better place to define this is probably colgroup. However, it seems like the spec moved away of using colgroup at all because all attributes (including width) seem to be deprecated. I find this a bit strange because it allows a convenient way to define column properties. Since tables are defined column-wise but are rendered row-wise, it becomes hard to define column props without writing nth-child selectors all the time. As written above, for ordering, nth-child doesn't seem to be a proper solution anyway. Hiding or rearranging columns are powerful features needed in a lot of rich web applications and providing an easy way to do it in CSS would be awesome.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions