Csswg-drafts: [css-tables] Let `*-gap` properties apply to tables

Created on 8 Mar 2020  ·  4Comments  ·  Source: w3c/csswg-drafts

In order to harmonize gap handling between all layouts, row-gap, column-gap and gap should also apply to tables.

This would deprecate border-spacing like it was done for the grid-*-gap properties before.

Sebastian

css-tables-3

Most helpful comment

Probably even more important difference between border-spacing and *-gap is that the former also adds spacing outside the cells, while the latter adds it only between them. Also, the gap shorthand and border-spacing have different component orders.

It might be worth noting that initially adding *-gap to tables was considered, but this idea was then rejected presumably due to complexity.

All 4 comments

Note that border-spacing only accepts lengths, while gap also accepts percentages. Given the madness of table layout, it may not be obvious how percentages should behave. Also, border-spacing has no effect with border-collapse: collapse, would it be the same for gap?

Probably even more important difference between border-spacing and *-gap is that the former also adds spacing outside the cells, while the latter adds it only between them. Also, the gap shorthand and border-spacing have different component orders.

It might be worth noting that initially adding *-gap to tables was considered, but this idea was then rejected presumably due to complexity.

So unless you think there is anything new to be said about this, I guess Wontfix by CSSWG resolution.
https://logs.csswg.org/irc.w3.org/css/2017-08-04/#e847611

Thank you for the hints, @Loirooriol and @SelenIT!

So it looks like the *-gap properties cannot simply replace border-spacing.

From what I read, the technical issues are that in opposite to the *-gap properties border-spacing is inherited, it adds spacing outside the cells, it only accepts lengths, and it is affected by border-collapse. And there was the question when the *-gap properties would apply and when border-spacing.

From my point of view, the answer to the first three issues is to let them apply exactly like in the other layouts where they can be used, i.e. they don't inherit, they don't add spacing outside the cells (can be done by setting a padding if needed), and they also accept percentages the same way as defined now, meaning they resolve against the box’s content box when laying out its contents.
Regarding whether border-collapse should affect them I tend to say yes in order to keep the possibility to avoid double borders between cells.
As for when the *-gap properties apply, I go with @fantasai's note that they are used when set to a length or percentage. If they are set to normal, border-spacing is used.

All the technical issues aside, I guess the bigger issue here is probably that implementers seem to be reluctant to change their table layout implementations.

Sebastian

Was this page helpful?
0 / 5 - 0 ratings