Skip to content

[css-tables] table-wrapper box and captions #471

@gregwhitworth

Description

@gregwhitworth

Compat Issues: yes

Description:
In CSS 2.1, captions are moved outside the table-box to the table-wrapper box. It is however not defined how that works at all, and of course this is not interoperable.

Proposed Option:
I think we should remove this entirely. It doesn't work like it says it does in most browsers.

Besides, it is unnecessary to explain the caption behavior (since table-root boxes are a block formatting context, we can position these captions in the margin area of the table box, and mandate browsers to create a margin on both sides of the table box to encompass the captions. Since the table-wrapper box creates a bfc, these margins won't collapse.

Having the size of the table depend on that of the caption when it is outside of the table wrapper box doesn't keep the consistency of block layout, which is what the table wrapper box and the caption are.

CSS 2.1 Option:
Captions should be sized as though they are in a block outside of the table, but they still need to influence the min-width of the table box.

Testcases:
https://jsfiddle.net/jy3zydg4/
https://jsfiddle.net/x1dLp4fu/1/

Browsers Passing Test:
Blink, Webkit, Edge match our proposal, and Firefox sort of matches that of 2.1 but it was buggy: for instance, percentages are applied twice (so 90% ends up being 81%).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions